99from datetime import datetime
1010from httpx import Client
1111
12- from domaintools .constants import OutputFormat , HEADER_ACCEPT_KEY_CSV_FORMAT
12+ from domaintools .constants import FEEDS_PRODUCTS_LIST , OutputFormat , HEADER_ACCEPT_KEY_CSV_FORMAT
1313from domaintools .exceptions import (
1414 BadRequestException ,
1515 InternalServerErrorException ,
2020 IncompleteResponseException ,
2121 RequestUriTooLongException ,
2222)
23- from domaintools .utils import get_feeds_products_list
2423
2524
2625try : # pragma: no cover
@@ -93,7 +92,7 @@ def _make_request(self):
9392 patch_data = self .kwargs .copy ()
9493 patch_data .update (self .api .extra_request_params )
9594 return session .patch (url = self .url , json = patch_data )
96- elif self .product in get_feeds_products_list () :
95+ elif self .product in FEEDS_PRODUCTS_LIST :
9796 parameters = deepcopy (self .kwargs )
9897 parameters .pop ("output_format" , None )
9998 parameters .pop (
@@ -139,8 +138,7 @@ def data(self):
139138 self .setStatus (results .status_code , results )
140139 if (
141140 self .kwargs .get ("format" , "json" ) == "json"
142- and self .product
143- not in get_feeds_products_list () # Special handling of feeds products' data to preserve the result in jsonline format
141+ and self .product not in FEEDS_PRODUCTS_LIST # Special handling of feeds products' data to preserve the result in jsonline format
144142 ):
145143 self ._data = results .json ()
146144 else :
@@ -157,7 +155,7 @@ def data(self):
157155 return self ._data
158156
159157 def check_limit_exceeded (self ):
160- if self .kwargs .get ("format" , "json" ) == "json" and self .product not in get_feeds_products_list () :
158+ if self .kwargs .get ("format" , "json" ) == "json" and self .product not in FEEDS_PRODUCTS_LIST :
161159 if "response" in self ._data and "limit_exceeded" in self ._data ["response" ] and self ._data ["response" ]["limit_exceeded" ] is True :
162160 return True , self ._data ["response" ]["message" ]
163161 # TODO: handle html, xml response errors better.
0 commit comments