(self, request_type)
return authenticated
Automatically generate a request instance to use.

        In the end, this saves us from having to load each request class in a
        explicit way. Loading via a string is helpful to reduce the code per
        call.
Automatically generate a request instance to use.
Automatically generate a request instance to use .
def _generate_request_instance(self, request_type):
        """Automatically generate a request instance to use.

        In the end, this saves us from having to load each request class in a
        explicit way. Loading via a string is helpful to reduce the code per
        call.
        """
        crits_config = CRITsConfig.objects().first()

        http_proxy_value = None

        if crits_config.http_proxy:
            http_proxy_value = crits_config.http_proxy

        class_lookup = {'dns': 'DnsRequest', 'whois': 'WhoisRequest',
                        'ssl': 'SslRequest', 'enrichment': 'EnrichmentRequest',
                        'attributes': 'AttributeRequest'}
        class_name = class_lookup[request_type]
        mod = __import__('passivetotal.libs.%s' % request_type,
                         fromlist=[class_name])
        loaded = getattr(mod, class_name)
        headers = {'PT-INTEGRATION': 'CRITs'}
        authenticated = loaded(self.username, self.api_key, headers=headers,
            http_proxy=http_proxy_value, https_proxy=http_proxy_value)

        return authenticated
def _generate_request_instance ( self , request_type ) : crits_config = CRITsConfig . objects ( ) . first ( ) http_proxy_value = None if crits_config . http_proxy : http_proxy_value = crits_config . http_proxy class_lookup = { 'dns' : 'DnsRequest' , 'whois' : 'WhoisRequest' , 'ssl' : 'SslRequest' , 'enrichment' : 'EnrichmentRequest' , 'attributes' : 'AttributeRequest' } class_name = class_lookup [ request_type ] mod = __import__ ( 'passivetotal.libs.%s' % request_type , fromlist = [ class_name ] ) loaded = getattr ( mod , class_name ) headers = { 'PT-INTEGRATION' : 'CRITs' } authenticated = loaded ( self . username , self . api_key , headers = headers , http_proxy = http_proxy_value , https_proxy = http_proxy_value ) return authenticated