For verifying your API key.
        
        Provide the URL of your site or blog you will be checking spam from.
192132
def verify_key(self, url):
        
        
        response = self._request('verify-key', {
            'blog': url,
            'key': self._key
        })
        
        if response.status is 200:
            # Read response (trimmed of whitespace)
            return response.read().strip() == "valid"
            
        return False
1107136
function verifyMailgun(apikey, token, timestamp, signature) {
  var data = [timestamp, token].join('');
  var hmac = crypto.createHmac('sha256', apikey).update(data);
  var ourSig = hmac.digest('hex');

  var output = {
    apikey: apikey,
    token: token,
    timestamp: timestamp,
    signature: signature,
    generatedSignature: ourSig,
    valid: ourSig === signature
  };

  return output;
}
1068297
private Link verify(Link link) {

		Assert.notNull(link, "Link must not be null!");

		try {

			String uri = link.expand().getHref();

			this.log.debug("Verifying link pointing to {}…", uri);
			this.restOperations.headForHeaders(uri);
			this.log.debug("Successfully verified link!");

			return link;

		}
		catch (RestClientException o_O) {

			this.log.debug("Verification failed, marking as outdated!");
			return null;
		}
	}
1134191
def check_uri_security(uri):
    """"""
    if urlparse(uri).scheme != 'https':
        warning_message = (
            'WARNING: this client is sending a request to an insecure'
            ' API endpoint. Any API request you make may expose your API key and'
            ' secret to third parties. Consider using the default endpoint:\n\n'
            '  %s\n') % uri
        warnings.warn(warning_message, UserWarning)
    return uri
1107594
def sitemap_check(url):
        
        response = urllib2.urlopen(UrlExtractor.get_sitemap_url(url, True))

        # Check if "Sitemap" is set
        return "Sitemap:" in response.read().decode('utf-8')
928223
def __pre_check(self, requestedUrl):
		'''
		
		'''
		components = urllib.parse.urlsplit(requestedUrl)

		netloc_l = components.netloc.lower()
		if netloc_l in Domain_Constants.SUCURI_GARBAGE_SITE_NETLOCS:
			self.__check_suc_cookie(components)
		elif netloc_l in Domain_Constants.CF_GARBAGE_SITE_NETLOCS:
			self.__check_cf_cookie(components)
		elif components.path == '/sucuri_shit_2':
			self.__check_suc_cookie(components)
		elif components.path == '/sucuri_shit_3':
			self.__check_suc_cookie(components)
		elif components.path == '/cloudflare_under_attack_shit_2':
			self.__check_cf_cookie(components)
		elif components.path == '/cloudflare_under_attack_shit_3':
			self.__check_cf_cookie(components)
312345
def check_is_spam(content, content_object, request,
                  backends=None):
    
    if backends is None:
        backends = SPAM_CHECKER_BACKENDS

    for backend_path in backends:
        spam_checker = get_spam_checker(backend_path)
        if spam_checker is not None:
            is_spam = spam_checker(content, content_object, request)
            if is_spam:
                return True

    return False
783864
def markAsSpam(self, thread_id=None):
        
        thread_id, thread_type = self._getThread(thread_id, None)
        r = self._post(self.req_url.MARK_SPAM, {"id": thread_id})
        return r.ok
693794
def verify_endpoint_url(web_url)
      begin
        resource = RestClient::Resource.new web_url
        resource.get
      rescue RestClient::Exception => e
        if e.http_code == 404
          set_valid(false)
        end
      end
    end
1214675
def get_spam_checker(backend_path):
    
    try:
        backend_module = import_module(backend_path)
        backend = getattr(backend_module, 'backend')
    except (ImportError, AttributeError):
        warnings.warn('%s backend cannot be imported' % backend_path,
                      RuntimeWarning)
        backend = None
    except ImproperlyConfigured as e:
        warnings.warn(str(e), RuntimeWarning)
        backend = None

    return backend
262385
def validate_registration(self):
        '''
        
        '''
        url = '/api/%s' % self.username
        response = self.make_request('GET', url)

        if 'error' in response:
            return False

        return True
338556
def sample_verify_callback(is_ok, ctx)
    unless is_ok
      depth = ctx.error_depth
      code = ctx.error
      msg = ctx.error_string
      STDERR.puts "at depth #{depth} - #{code}: #{msg}" if $DEBUG
      return false
    end

    cert = ctx.current_cert
    self_signed = false
    ca = false
    pathlen = nil
    server_auth = true
    self_signed = (cert.subject.cmp(cert.issuer) == 0)

    # Check extensions whatever its criticality is. (sample)
    cert.extensions.each do |ex|
      case ex.oid
      when 'basicConstraints'
        /CA:(TRUE|FALSE), pathlen:(\d+)/ =~ ex.value
        ca = ($1 == 'TRUE')
        pathlen = $2.to_i
      when 'keyUsage'
        usage = ex.value.split(/\s*,\s*/)
        ca = usage.include?('Certificate Sign')
        server_auth = usage.include?('Key Encipherment')
      when 'extendedKeyUsage'
        usage = ex.value.split(/\s*,\s*/)
        server_auth = usage.include?('Netscape Server Gated Crypto')
      when 'nsCertType'
        usage = ex.value.split(/\s*,\s*/)
        ca = usage.include?('SSL CA')
        server_auth = usage.include?('SSL Server')
      end
    end

    if self_signed
      STDERR.puts 'self signing CA' if $DEBUG
      return true
    elsif ca
      STDERR.puts 'middle level CA' if $DEBUG
      return true
    elsif server_auth
      STDERR.puts 'for server authentication' if $DEBUG
      return true
    end

    return false
  end
9026
def _get_site_status_code(self, url, status_code, api, num_tries, num_apikey_tries):
        
        # Make status code an int
        try:
            status_code = int(status_code)
        except ValueError:
            logger.exception("Incorrect status code passed in")
            return None
        # TODO: Try with the same api key 3 times, then try with with a new apikey the same way for 3 times as well
        # try_profile_again = False
        # if api is True and num_apikey_tries < self._num_retries:
        #     # Try with the same apikey/profile again after a short wait
        #     try_profile_again = True

        # Retry for any status code in the 400's or greater
        if status_code >= 400 and num_tries < self._num_retries:
            # Fail after 3 tries
            logger.info("HTTP error, try #{}, Status: {} on url: {}".format(num_tries, status_code, url),
                        extra={'status_code': status_code,
                               'num_tries': num_tries,
                               'url': url})
            time.sleep(.5)
            self.new_profile()
            return True

        else:
            logger.warning("HTTPError [get_site]\n\t# of Tries: {}\n\tCode: {} - {}"
                           .format(num_tries, status_code, url),
                           extra={'status_code': status_code,
                                  'num_tries': num_tries,
                                  'url': url})

        return None
1223422
def check_for_additional_actions(self, url_params: dict,
                                     html: str,
                                     login_data: dict) -> None:
        
        action_response = ''
        if 'sid' in url_params:
            action_response = self.handle_captcha(url_params, html, login_data)
        elif 'authcheck' in url_params:
            action_response = self.handle_two_factor_check(html)
        elif 'security_check' in url_params:
            action_response = self.handle_phone_number_check(html)
        if action_response:
            check_page_for_warnings(action_response.text)
583827
def verify(dataset, publication_date, source, refernce_url):
    """"""

    config = ApiConfig()
    client = ApiClient(config.host, config.app_id, config.app_secret)
    client.check_correct_host()
    client.verify(dataset, publication_date, source, refernce_url)
446770
def scan_ipaddr(ipaddr, apikey):
    
    logger.info('Query VirusTotal API for Public IP Found: %s', ipaddr)
    v_api = virus_total.VirusTotal()
    scan_ip = v_api.send_ip(ipaddr, apikey)
    response_code = scan_ip['response_code']
    verbose_msg = scan_ip['verbose_msg']
    urls = scan_ip['detected_urls']

    if urls:
        failure = True
        logger.error('%s has been known to resolve to malicious urls', ipaddr)
        for url in urls:
            logger.error('%s on date: %s', url['url'], url['scan_date'])
    else:
        logger.info('%s has no record of resolving to malicious urls', ipaddr)
1291445
def akismet_check(comment, content_object, request):
    
    # Return previously cached response
    akismet_result = getattr(comment, '_akismet_result_', None)
    if akismet_result is not None:
        return akismet_result

    # Get Akismet data
    AKISMET_API_KEY = appsettings.AKISMET_API_KEY
    if not AKISMET_API_KEY:
        raise ImproperlyConfigured('You must set AKISMET_API_KEY to use comment moderation with Akismet.')

    current_domain = get_current_site(request).domain
    auto_blog_url = '{0}://{1}/'.format(request.is_secure() and 'https' or 'http', current_domain)
    blog_url = appsettings.AKISMET_BLOG_URL or auto_blog_url

    akismet = Akismet(
        AKISMET_API_KEY,
        blog=blog_url,
        is_test=int(bool(appsettings.AKISMET_IS_TEST)),
        application_user_agent='django-fluent-comments/{0}'.format(fluent_comments.__version__),
    )

    akismet_data = _get_akismet_data(blog_url, comment, content_object, request)
    akismet_result = akismet.check(**akismet_data)  # raises AkismetServerError when key is invalid
    setattr(comment, "_akismet_result_", akismet_result)
    return akismet_result