@@ -92,7 +92,9 @@ def __init__(
9292 self ._build_api_url (api_url , api_port )
9393
9494 if not https :
95- raise Exception ("The DomainTools API endpoints no longer support http traffic. Please make sure https=True." )
95+ raise Exception (
96+ "The DomainTools API endpoints no longer support http traffic. Please make sure https=True."
97+ )
9698 if proxy_url and not isinstance (proxy_url , str ):
9799 raise Exception ("Proxy URL must be a string. For example: '127.0.0.1:8888'" )
98100
@@ -129,7 +131,8 @@ def _results(self, product, path, cls=Results, **kwargs):
129131 always_sign_api_key_previous_value = self .always_sign_api_key
130132 header_authentication_previous_value = self .header_authentication
131133 self ._rate_limit ()
132- # Reset always_sign_api_key and header_authentication to its original User-set values as these might be affected when self.account_information() was executed
134+ # Reset always_sign_api_key and header_authentication to its original
135+ # User-set values as these might be affected when self.account_information() was executed
133136 self .always_sign_api_key = always_sign_api_key_previous_value
134137 self .header_authentication = header_authentication_previous_value
135138
@@ -139,7 +142,13 @@ def _results(self, product, path, cls=Results, **kwargs):
139142 is_rttf_product = product in RTTF_PRODUCTS_LIST
140143 self ._handle_api_key_parameters (is_rttf_product )
141144 self .handle_api_key (is_rttf_product , path , parameters )
142- parameters .update ({key : str (value ).lower () if value in (True , False ) else value for key , value in kwargs .items () if value is not None })
145+ parameters .update (
146+ {
147+ key : str (value ).lower () if value in (True , False ) else value
148+ for key , value in kwargs .items ()
149+ if value is not None
150+ }
151+ )
143152
144153 return cls (self , product , uri , ** parameters )
145154
@@ -189,8 +198,20 @@ def snakecase(string):
189198 string [1 :],
190199 )
191200
192- api_calls = tuple ((api_call for api_call in dir (API ) if not api_call .startswith ("_" ) and callable (getattr (API , api_call , None ))))
193- return sorted ([snakecase (p ["id" ]) for p in self .account_information ()["products" ] if snakecase (p ["id" ]) in api_calls ])
201+ api_calls = tuple (
202+ (
203+ api_call
204+ for api_call in dir (API )
205+ if not api_call .startswith ("_" ) and callable (getattr (API , api_call , None ))
206+ )
207+ )
208+ return sorted (
209+ [
210+ snakecase (p ["id" ])
211+ for p in self .account_information ()["products" ]
212+ if snakecase (p ["id" ]) in api_calls
213+ ]
214+ )
194215
195216 def brand_monitor (self , query , exclude = None , domain_status = None , days_back = None , ** kwargs ):
196217 """Pass in one or more terms as a list or separated by the pipe character ( | )"""
@@ -445,7 +466,16 @@ def iris(
445466 """Performs a search for the provided search terms ANDed together,
446467 returning the pivot engine row data for the resulting domains.
447468 """
448- if not domain and not ip and not email and not nameserver and not registrar and not registrant and not registrant_org and not kwargs :
469+ if (
470+ not domain
471+ and not ip
472+ and not email
473+ and not nameserver
474+ and not registrar
475+ and not registrant
476+ and not registrant_org
477+ and not kwargs
478+ ):
449479 raise ValueError ("At least one search term must be specified" )
450480
451481 return self ._results (
@@ -1069,7 +1099,10 @@ def nod(self, **kwargs) -> FeedsResults:
10691099 validate_feeds_parameters (kwargs )
10701100 endpoint = kwargs .pop ("endpoint" , Endpoint .FEED .value )
10711101 source = ENDPOINT_TO_SOURCE_MAP .get (endpoint )
1072- if endpoint == Endpoint .DOWNLOAD .value or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value :
1102+ if (
1103+ endpoint == Endpoint .DOWNLOAD .value
1104+ or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value
1105+ ):
10731106 # headers param is allowed only in Feed API and CSV format
10741107 kwargs .pop ("headers" , None )
10751108
@@ -1101,7 +1134,10 @@ def nad(self, **kwargs) -> FeedsResults:
11011134 validate_feeds_parameters (kwargs )
11021135 endpoint = kwargs .pop ("endpoint" , Endpoint .FEED .value )
11031136 source = ENDPOINT_TO_SOURCE_MAP .get (endpoint ).value
1104- if endpoint == Endpoint .DOWNLOAD .value or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value :
1137+ if (
1138+ endpoint == Endpoint .DOWNLOAD .value
1139+ or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value
1140+ ):
11051141 # headers param is allowed only in Feed API and CSV format
11061142 kwargs .pop ("headers" , None )
11071143
@@ -1162,7 +1198,10 @@ def domaindiscovery(self, **kwargs) -> FeedsResults:
11621198 validate_feeds_parameters (kwargs )
11631199 endpoint = kwargs .pop ("endpoint" , Endpoint .FEED .value )
11641200 source = ENDPOINT_TO_SOURCE_MAP .get (endpoint ).value
1165- if endpoint == Endpoint .DOWNLOAD .value or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value :
1201+ if (
1202+ endpoint == Endpoint .DOWNLOAD .value
1203+ or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value
1204+ ):
11661205 # headers param is allowed only in Feed API and CSV format
11671206 kwargs .pop ("headers" , None )
11681207
@@ -1194,7 +1233,10 @@ def noh(self, **kwargs) -> FeedsResults:
11941233 validate_feeds_parameters (kwargs )
11951234 endpoint = kwargs .pop ("endpoint" , Endpoint .FEED .value )
11961235 source = ENDPOINT_TO_SOURCE_MAP .get (endpoint ).value
1197- if endpoint == Endpoint .DOWNLOAD .value or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value :
1236+ if (
1237+ endpoint == Endpoint .DOWNLOAD .value
1238+ or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value
1239+ ):
11981240 # headers param is allowed only in Feed API and CSV format
11991241 kwargs .pop ("headers" , None )
12001242
@@ -1225,7 +1267,10 @@ def realtime_domain_risk(self, **kwargs) -> FeedsResults:
12251267 validate_feeds_parameters (kwargs )
12261268 endpoint = kwargs .pop ("endpoint" , Endpoint .FEED .value )
12271269 source = ENDPOINT_TO_SOURCE_MAP .get (endpoint ).value
1228- if endpoint == Endpoint .DOWNLOAD .value or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value :
1270+ if (
1271+ endpoint == Endpoint .DOWNLOAD .value
1272+ or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value
1273+ ):
12291274 # headers param is allowed only in Feed API and CSV format
12301275 kwargs .pop ("headers" , None )
12311276
@@ -1256,7 +1301,10 @@ def domainhotlist(self, **kwargs) -> FeedsResults:
12561301 validate_feeds_parameters (kwargs )
12571302 endpoint = kwargs .pop ("endpoint" , Endpoint .FEED .value )
12581303 source = ENDPOINT_TO_SOURCE_MAP .get (endpoint ).value
1259- if endpoint == Endpoint .DOWNLOAD .value or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value :
1304+ if (
1305+ endpoint == Endpoint .DOWNLOAD .value
1306+ or kwargs .get ("output_format" , OutputFormat .JSONL .value ) != OutputFormat .CSV .value
1307+ ):
12601308 # headers param is allowed only in Feed API and CSV format
12611309 kwargs .pop ("headers" , None )
12621310
0 commit comments