Skip to content

Commit 2bcbb60

Browse files
committed
first pass at ignoring account info rate limit when making api queries
1 parent b35d12c commit 2bcbb60

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

domaintools/api.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
filter_by_field,
3535
DTResultFilter,
3636
)
37+
from domaintools.exceptions import ServiceUnavailableException, ServiceException
3738
from domaintools.utils import validate_feeds_parameters
3839

3940

@@ -163,7 +164,12 @@ def _results(self, product, path, cls=Results, **kwargs):
163164
if product != "account-information" and self.rate_limit and not self.limits_set and not self.limits:
164165
always_sign_api_key_previous_value = self.always_sign_api_key
165166
header_authentication_previous_value = self.header_authentication
166-
self._rate_limit(product)
167+
try:
168+
self._rate_limit(product)
169+
except (ServiceUnavailableException, ServiceException):
170+
# If account_information fails (e.g. rate limited itself),
171+
# skip client-side rate limiting and proceed with the original call.
172+
self.limits_set = True
167173
# Reset always_sign_api_key and header_authentication to its original
168174
# User-set values as these might be affected when self.account_information() was executed
169175
self.always_sign_api_key = always_sign_api_key_previous_value

0 commit comments

Comments
 (0)