Validates the Rapid API key, password and endpoint
165902
def validate_api_param
      set_valid(true)
      if @api_key.nil? || @api_key.empty? || @password.nil? || @password.empty?
        add_error_code(Constants::API_KEY_INVALID_ERROR_CODE)
        set_valid(false)
      end
      if @rapid_endpoint.nil? || @rapid_endpoint.empty?
        add_error_code(Constants::LIBRARY_NOT_HAVE_ENDPOINT_ERROR_CODE)
        set_valid(false)
      end
      if @is_valid
        begin
          parser_endpoint_to_web_url
          unless @list_error.nil?
            @list_error.clear
          end
          set_valid(true)
          @logger.info "Initiate client using [#{@web_url}] successful!" if @logger
        rescue => e
          @logger.error "Error setting Rapid endpoint #{e.backtrace.inspect}" if @logger
          set_valid(false)
          add_error_code(Constants::LIBRARY_NOT_HAVE_ENDPOINT_ERROR_CODE)
        end
      else
        @logger.warn 'Invalid parameter passed to Rapid client' if @logger
      end
    end
349680
def _validate(self):
        
        for key in self:
            if key not in DEFAULTS:
                raise exceptions.ConfigurationException(
                    'Unknown configuration key "{}"! Valid configuration keys are'
                    " {}".format(key, list(DEFAULTS.keys()))
                )

        validate_queues(self["queues"])
        validate_bindings(self["bindings"])
        validate_client_properties(self["client_properties"])
1216217
def validate(self):
        """"""
        try:
            response = self.client.get_access_key_last_used(
                AccessKeyId=self.access_key_id
            )

            username = response['UserName']
            access_keys = self.client.list_access_keys(
                UserName=username
            )

            for key in access_keys['AccessKeyMetadata']:
                if \
                        (key['AccessKeyId'] == self.access_key_id)\
                        and (key['Status'] == 'Inactive'):
                    return True

            return False
        except Exception as e:
            logger.info(
                "Failed to validate key disable for "
                "key {id} due to: {e}.".format(
                    e=e, id=self.access_key_id
                )
            )
            return False
980788
def nanopub_validate(ctx, input_fn, output_fn, api, config_fn):
    """"""

    if config_fn:
        config = bel.db.Config.merge_config(ctx.config, override_config_fn=config_fn)
    else:
        config = ctx.config

    api = utils.first_true(
        [api, config["bel_api"]["servers"].get("api_url", None)], None
    )

    print(f"Running validate nanopubs using {api}")
647788
def is_suitable(self, request):
        
        if self.key_type:
            validation = KEY_TYPE_VALIDATIONS.get( self.get_type() )
            return validation( request ) if validation else None
        return True
408831
def validate_response(self, resp):
        
        ok, msg = self.contract.validate(self.returns, 
                                         self.returns.is_array, resp)
        if not ok:
            vals = (self.full_name, str(resp), msg)
            msg = "Function '%s' invalid response: '%s'. %s" % vals
            raise RpcException(ERR_INVALID_RESP, msg)
737934
def check_key(request):
    '''
        
    '''
    api_objs = list(Api.objects.filter(name=request.POST['api']))
    if not api_objs:
        return HttpResponseBadRequest('Must specify valid API')

    # check the signature
    if get_signature(request.POST, api_objs[0].signing_key) != request.POST['signature']:
        return HttpResponseBadRequest('bad signature')

    get_object_or_404(Key, key=request.POST['key'], status='A')

    return HttpResponse('OK')
118910
def validate_path_parameters(target_path, api_path, path_parameters, context):
    
    base_path = context.get('basePath', '')
    full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path)
    parameter_values = get_path_parameter_values(
        target_path, full_api_path, path_parameters, context,
    )
    validate_parameters(parameter_values, path_parameters, context=context)
1308187
def validate(self):
        
        endpoint = '/validate'

        payload = dict(accessToken=self.access_token)
        rep = self._ygg_req(endpoint, payload)
        return not bool(rep)
68367
def validate(self):
        """"""
        try:
            for pkg in self.resolved_packages:
                pkg.validate_data()
        except RezError as e:
            raise ResolvedContextError("%s: %s" % (e.__class__.__name__, str(e)))
801440
def validate(url, schemes=None, tlds=None, private=None, local=None,
             credentials=None):
    '''
    
    '''
    url = url.strip()

    private = config_for(private, 'URLS_ALLOW_PRIVATE')
    local = config_for(local, 'URLS_ALLOW_LOCAL')
    credentials = config_for(credentials, 'URLS_ALLOW_CREDENTIALS')
    schemes = config_for(schemes, 'URLS_ALLOWED_SCHEMES')
    tlds = config_for(tlds, 'URLS_ALLOWED_TLDS')

    match = URL_REGEX.match(url)
    if not match:
        error(url)

    scheme = (match.group('scheme') or '').lower()
    if scheme and scheme not in schemes:
        error(url, 'Invalid scheme {0}'.format(scheme))

    if not credentials and match.group('credentials'):
        error(url, 'Credentials in URL are not allowed')

    tld = match.group('tld')
    if tld and tld not in tlds and tld.encode('idna') not in tlds:
        error(url, 'Invalid TLD {0}'.format(tld))

    ip = match.group('ipv6') or match.group('ipv4')
    if ip:
        try:
            ip = IPAddress(ip)
        except AddrFormatError:
            error(url)
        if ip.is_multicast():
            error(url, '{0} is a multicast IP'.format(ip))
        elif not ip.is_loopback() and ip.is_hostmask() or ip.is_netmask():
            error(url, '{0} is a mask IP'.format(ip))

    if not local:
        if ip and ip.is_loopback() or match.group('localhost'):
            error(url, 'is a local URL')

    if not private and ip and ip.is_private():
        error(url, 'is a private URL')

    return url
39598
def validate():
    """"""

    errors = dict()
    for test in (test_architecture,
                 test_pyqt_availability,
                 test_pyblish_availability,
                 test_qtconf_availability,
                 test_qtconf_correctness,
                 test_qt_availability):
        try:
            test()
        except Exception as e:
            errors[test] = e

    if not errors:
        print("=" * 78)
        print()
        print(""" - Success!

{exe} is well suited to run Pyblish QML""".format(exe=sys.executable))
        print()
        print("=" * 78)

        return True

    print("=" * 78)
    print()
    print(" - Failed")
    print()
    for test, error in errors.iteritems():
        print(test.__name__)
        print("    %s" % error)
    print()
    print("=" * 78)

    return False
459341
def validate_keys(self):
        
        url = 'https://api.twitter.com/1.1/account/verify_credentials.json'

        keys_present = self.consumer_key and self.consumer_secret and \
                       self.access_token and self.access_token_secret

        if keys_present:
            try:
                # Need to explicitly reconnect to confirm the current creds
                # are used in the session object.
                self.connect()
                self.get(url)
            except requests.HTTPError as e:
                if e.response.status_code == 401:
                    raise RuntimeError('Invalid credentials provided.')
                else:
                    raise e
        else:
            raise RuntimeError('Incomplete credentials provided.')
1189898
function(privKey) {
      validatePrivKey(privKey);
      var raw_keys = curve25519.keyPair(privKey);
      if (raw_keys instanceof Promise) {
        return raw_keys.then(processKeys);
      } else {
        return processKeys(raw_keys);
      }
    }
604785
def validate_request_file_upload(owner, repo, filepath, md5_checksum=None):
    """"""
    client = get_files_api()
    md5_checksum = md5_checksum or calculate_file_md5(filepath)

    with catch_raise_api_exception():
        _, _, headers = client.files_validate_with_http_info(
            owner=owner,
            repo=repo,
            data={"filename": os.path.basename(filepath), "md5_checksum": md5_checksum},
        )

    ratelimits.maybe_rate_limit(client, headers)
    return md5_checksum
24346
function verifyEndpoint(request, respond)
{
  var challenge;

  if (typeof request.query == 'string')
  {
    request.query = qs.parse(request.query);
  }

  if (typeof request.query == 'object'
    && ((request.query['hub.verify_token'] === this.credentials.secret)
        // for hapi@10 and restify/express with queryParser check for `hub` object
    || (typeof request.query.hub == 'object' && request.query.hub['verify_token'] === this.credentials.secret)
    )
  )
  {
    challenge = request.query['hub.challenge'] || (request.query.hub ? request.query.hub.challenge : null);

    this.logger.debug({message: 'Successfully verified', challenge: challenge});
    respond(challenge);
    return;
  }

  this.logger.error({message: 'Unable to verify endpoint', query: request.query});
  respond(400, 'Error, wrong validation token');
}
213550
def validate_user(user,
                  device,
                  token):
    '''
    
    '''
    res = {
            'message': 'User key is invalid',
            'result': False
           }

    parameters = dict()
    parameters['user'] = user
    parameters['token'] = token
    if device:
        parameters['device'] = device

    response = query(function='validate_user',
                     method='POST',
                     header_dict={'Content-Type': 'application/x-www-form-urlencoded'},
                     data=_urlencode(parameters))

    if response['res']:
        if 'message' in response:
            _message = response.get('message', '')
            if 'status' in _message:
                if _message.get('dict', {}).get('status', None) == 1:
                    res['result'] = True
                    res['message'] = 'User key is valid.'
                else:
                    res['result'] = False
                    res['message'] = ''.join(_message.get('dict', {}).get('errors'))
    return res