Verify that the response is OK
330364
def parse_authz_decision_query_response(self, response,
            binding=BINDING_SOAP):
        
        kwargs = {"entity_id": self.config.entityid,
                  "attribute_converters": self.config.attribute_converters}

        return self._parse_response(response, AuthzResponse, "", binding,
                                    **kwargs)
146094
def _check(self, accepted):
        """"""
        # logging.debug('A check is now happening...')
        # for key in self.statediag[1].trans:
        #    logging.debug('transition to '+`key`+" with "+self.statediag[1].trans[key][0])
        total = []
        if 1 in self.quickresponse:
            total = total + self.quickresponse[1]
        if (1, 0) in self.quickresponse:
            total = total + self.quickresponse[(1, 0)]
        for key in total:
            if (key.id == 1 or key.id == (1, 0)) and key.type == 3:
                if accepted is None:
                    if 2 in key.trans:
                        # print 'Found'
                        return key.trans[2]
                else:
                    for state in accepted:
                        if (2, state) in key.trans:
                            # print 'Found'
                            return key.trans[(2, state)]
        return -1
914775
def verify_checksum(response, expecting)
      if verify_checksums
        if Crc16.ekm_crc16_matches?(response[1..-3], expecting)
          @logger.debug "Checksum matches"
        else
          @logger.error "CRC16 Checksum doesn't match. Expecting #{expecting} but was #{Crc16.crc16(response)}"
          #raise EkmOmnimeterError, "Checksum doesn't match"
        end
      end
    end
700586
def _validate_response(response):
        
        try:
            response.raise_for_status()
        except requests.RequestException:
            raise RequestException(
                code=response.status_code,
                url=response.url,
                description=response.text)
        else:
            return response
1222961
def check_response(self, resp):
        

        # For successful API call, response code will be 200 (OK)
        if resp.ok:
            json = resp.json()
            self.response = ResponseHolder()
            self.response.response = json

            # Check the code
            if 'status' not in json:
                raise InvalidResponse('No status field')

            self.response.status = self.field_to_long(json['status'])
            if self.response.status != EBConsts.STATUS_OK:
                txt_status = self.get_text_status(json)
                raise InvalidStatus('Status is %s (%04X)'
                                    % (txt_status if txt_status is not None else "", self.response.status))

            if self.response_checker is not None:
                self.response_checker(self.response)

            return self.response

        else:
            # If response code is not ok (200), print the resulting http error code with description
            resp.raise_for_status()
        pass
420058
def check_response(self, response):
        
        if response.status_code == 401:
            raise D4S2Error(UNAUTHORIZED_MESSAGE)
        if not 200 <= response.status_code < 300:
            raise D4S2Error("Request to {} failed with {}:\n{}.".format(response.url, response.status_code,
                                                                        response.text))
1167120
private boolean isValid(String response, List<String> options) {

		boolean rslt = false;	// default...

		if (options.size() == 0) {
			// If no acceptable responses are specified, it's wide open...
			rslt = true;
		} else {
			for (String o : options) {
				if (response.matches(o)) {
					rslt = true;
					break;
				}
			}
		}
		
		return rslt;
		
	}
1270119
def check_response(response)
      if response.code == 200
        JSON.parse(response.body)['data']
      else
        'NOK: error code = ' + response.code.to_s
      end
    end
1285390
def _check_response(response, expected):
        

        response_code = response.status_code
        if expected == response_code:
            return

        if response_code < 400:
            raise ex.UnexpectedResponseCodeException(response.text)

        elif response_code == 401:
            raise ex.UnauthorizedException(response.text)

        elif response_code == 400:
            raise ex.BadRequestException(response.text)

        elif response_code == 403:
            raise ex.ForbiddenException(response.text)

        elif response_code == 404:
            raise ex.NotFoundException(response.text)

        elif response_code == 429:
            raise ex.RateLimitedException(response.text)

        else:
            raise ex.InternalServerErrorException(response.text)
748544
def check_authenticator_response(password, nt_response, peer_challenge, authenticator_challenge, user_name, received_response):
    """"""
    my_resppnse = generate_authenticator_response(password, nt_response, peer_challenge, authenticator_challenge, user_name)

    return my_resppnse == received_response
355175
private void verifyBulkJsonResponse(JSONAware pJsonResponse) throws J4pException {
        if (!(pJsonResponse instanceof JSONArray)) {
            if (pJsonResponse instanceof JSONObject) {
                JSONObject errorObject = (JSONObject) pJsonResponse;

                if (!errorObject.containsKey("status") || (Long) errorObject.get("status") != 200) {
                    throw new J4pRemoteException(null, errorObject);
                }
            }
            throw new J4pException("Invalid JSON answer for a bulk request (expected an array but got a " + pJsonResponse.getClass() + ")");
        }
    }
490862
def check_response(self, resp):
        """"""
        if resp.status_code == 400:
            raise ApiException(json.loads(resp.content).get('message'))
        return resp
631248
def loop_until_valid_response(prompt):
    
    responses = {"Y": True, "YES": True, "TRUE": True,
                 "N": False, "NO": False, "FALSE": False}
    response = ""
    while response.upper() not in responses:
        response = raw_input(prompt)

    return responses[response.upper()]
213291
def ensure_success!(response)
      return if response.is_a? Net::HTTPSuccess

      message = "#{response.code} - #{response.message}"
      message += "\n#{response.body}" if response.body.present?

      raise Crapi::BadHttpResponseError, message
    end
625721
def is_valid(self):
        """"""
        for lineedit in self.lineedits:
            if lineedit in self.validate_data and lineedit.isEnabled():
                validator, invalid_msg = self.validate_data[lineedit]
                text = to_text_string(lineedit.text())
                if not validator(text):
                    QMessageBox.critical(self, self.get_name(),
                                     "%s:<br><b>%s</b>" % (invalid_msg, text),
                                     QMessageBox.Ok)
                    return False
        return True
1002421
function verify(postedMessage) {
		if (
			// Check incoming message is valid
			typeof postedMessage === 'object' &&
			typeof postedMessage.uuid === 'string' &&
			postedMessage._respondable === true
		) {
			var messageSource = _getSource();
			return (
				// Check the version matches
				postedMessage._source === messageSource ||
				// Allow free communication with axe test
				postedMessage._source === 'axeAPI.x.y.z' ||
				messageSource === 'axeAPI.x.y.z'
			);
		}
		return false;
	}
885746
def validate_cmd_response_str(name, got, expected, hex_encode=True):
    
    if got != expected:
        if hex_encode:
            got_s = got.encode('hex')
            exp_s = expected.encode('hex')
        else:
            got_s = got
            exp_s = expected
        raise(pyhsm.exception.YHSM_Error("Bad %s in response (got %s, expected %s)" \
                                             % (name, got_s, exp_s)))
    return got