Skip to content

Commit 3a598fd

Browse files
committed
Remove x-api-key in test cassetes, disable rate limiting for rttf products
1 parent 5254e00 commit 3a598fd

13 files changed

+23649
-178681
lines changed

domaintools/api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ def _build_api_url(self, api_url=None, api_port=None):
112112

113113
self._rest_api_url = rest_api_url
114114

115-
def _rate_limit(self):
115+
def _rate_limit(self, product):
116116
"""Pulls in and enforces the latest rate limits for the specified user"""
117+
if product in RTTF_PRODUCTS_LIST:
118+
self.limits_set = False
119+
return
120+
117121
self.limits_set = True
118122
for product in self.account_information():
119123
limit_minutes = product["per_minute_limit"] or None
@@ -130,7 +134,7 @@ def _results(self, product, path, cls=Results, **kwargs):
130134
if product != "account-information" and self.rate_limit and not self.limits_set and not self.limits:
131135
always_sign_api_key_previous_value = self.always_sign_api_key
132136
header_authentication_previous_value = self.header_authentication
133-
self._rate_limit()
137+
self._rate_limit(product)
134138
# Reset always_sign_api_key and header_authentication to its original
135139
# User-set values as these might be affected when self.account_information() was executed
136140
self.always_sign_api_key = always_sign_api_key_previous_value

domaintools/results.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,7 @@ def _make_request(self) -> Generator:
247247

248248
def _get_results(self) -> Generator:
249249
try:
250-
wait_for = self._wait_time()
251-
if wait_for:
252-
log.info(f"Sleeping for {wait_for}s BEFORE REQUEST.")
253-
time.sleep(wait_for)
254-
255250
feeds_generator = self._make_request()
256-
257251
next(feeds_generator) # to start the generator process
258252
self.setStatus(self.latest_feeds_status_code) # set the status already
259253

tests/fixtures/vcr/test_domain_discovery_feed.yaml

Lines changed: 11 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,162 +2990,46 @@ interactions:
29902990
- api.domaintools.com
29912991
user-agent:
29922992
- python-httpx/0.28.1
2993-
x-api-key:
2994-
- 4b02d-a4719-e33e7-93128-5a5ff
2995-
method: GET
2996-
uri: https://api.domaintools.com/v1/feed/domaindiscovery/?after=-60&app_name=python_wrapper&app_version=2.5.2&header_authentication=false
2997-
response:
2998-
body:
2999-
string: '{"timestamp":"2025-10-06T16:40:38Z","domain":"albrologistics.com"}
3000-
3001-
{"timestamp":"2025-10-06T16:40:39Z","domain":"datablog.co.uk"}
3002-
3003-
{"timestamp":"2025-10-06T16:40:39Z","domain":"stelapratas.com"}
3004-
3005-
{"timestamp":"2025-10-06T16:40:39Z","domain":"donasveganasymas.com"}
3006-
3007-
{"timestamp":"2025-10-06T16:40:39Z","domain":"rdstore.shop"}
3008-
3009-
{"timestamp":"2025-10-06T16:40:39Z","domain":"basopbafep.at"}
3010-
3011-
'
3012-
headers:
3013-
Cache-Control:
3014-
- no-store, no-cache, must-revalidate
3015-
Content-Security-Policy:
3016-
- 'default-src * data: blob: ''unsafe-eval'' ''unsafe-inline'''
3017-
Content-Type:
3018-
- application/x-ndjson
3019-
Date:
3020-
- Mon, 06 Oct 2025 16:41:37 GMT
3021-
Expires:
3022-
- Thu, 19 Nov 1981 08:52:00 GMT
3023-
Pragma:
3024-
- no-cache
3025-
Set-Cookie:
3026-
- dtsession=mjnphs9kpucpipg5t5mksdvmchdrtomgf49bb5mnu64c971099658j14c65q5jhrh2f9pu589th4rt89d7lj2jq96p71d9m0fd854dm;
3027-
expires=Wed, 05-Nov-2025 16:41:37 GMT; Max-Age=2592000; path=/; domain=.domaintools.com;
3028-
secure; HttpOnly
3029-
- 0566fae076d9b6615cd8f47a9e9500f2=da9b98176bbb72d0ca7886ae363d40d4; path=/;
3030-
HttpOnly
3031-
Strict-Transport-Security:
3032-
- max-age=31536000; includeSubDomains
3033-
Transfer-Encoding:
3034-
- chunked
3035-
status:
3036-
code: 200
3037-
message: OK
3038-
- request:
3039-
body: ''
3040-
headers:
3041-
accept:
3042-
- '*/*'
3043-
accept-encoding:
3044-
- gzip, deflate
3045-
connection:
3046-
- keep-alive
3047-
host:
3048-
- api.domaintools.com
3049-
user-agent:
3050-
- python-httpx/0.28.1
3051-
x-api-key:
3052-
- 4b02d-a4719-e33e7-93128-5a5ff
3053-
method: GET
3054-
uri: https://api.domaintools.com/v1/feed/domaindiscovery/?after=-60&app_name=python_wrapper&app_version=2.5.3&top=5
3055-
response:
3056-
body:
3057-
string: '{"timestamp":"2025-10-08T13:34:20Z","domain":"ordalab.com"}
3058-
3059-
{"timestamp":"2025-10-08T13:34:20Z","domain":"shopwert.online"}
3060-
3061-
{"timestamp":"2025-10-08T13:34:20Z","domain":"ryaparts.fr"}
3062-
3063-
{"timestamp":"2025-10-08T13:34:20Z","domain":"21637.cn"}
3064-
3065-
{"timestamp":"2025-10-08T13:34:19Z","domain":"15054.cn"}
3066-
3067-
'
3068-
headers:
3069-
Cache-Control:
3070-
- no-store, no-cache, must-revalidate
3071-
Content-Length:
3072-
- '298'
3073-
Content-Security-Policy:
3074-
- 'default-src * data: blob: ''unsafe-eval'' ''unsafe-inline'''
3075-
Content-Type:
3076-
- application/x-ndjson
3077-
Date:
3078-
- Wed, 08 Oct 2025 13:34:21 GMT
3079-
Expires:
3080-
- Thu, 19 Nov 1981 08:52:00 GMT
3081-
Pragma:
3082-
- no-cache
3083-
Set-Cookie:
3084-
- dtsession=osvoe5vbplha77upcr3sdbhdchlemr0uacv0ar7rp6uecprl0hbcq89ooqvh6osi5ud5blhpl367lvlunomgar40tknvp4i8h9s66dr;
3085-
expires=Fri, 07-Nov-2025 13:34:21 GMT; Max-Age=2592000; path=/; domain=.domaintools.com;
3086-
secure; HttpOnly
3087-
- 0566fae076d9b6615cd8f47a9e9500f2=0335edaf1718dccec7bc612e6dd71941; path=/;
3088-
HttpOnly
3089-
Strict-Transport-Security:
3090-
- max-age=31536000; includeSubDomains
3091-
status:
3092-
code: 200
3093-
message: OK
3094-
- request:
3095-
body: ''
3096-
headers:
3097-
accept:
3098-
- '*/*'
3099-
accept-encoding:
3100-
- gzip, deflate
3101-
connection:
3102-
- keep-alive
3103-
host:
3104-
- api.domaintools.com
3105-
user-agent:
3106-
- python-httpx/0.28.1
3107-
x-api-key:
3108-
- 4b02d-a4719-e33e7-93128-5a5ff
31092993
method: GET
31102994
uri: https://api.domaintools.com/v1/feed/domaindiscovery/?after=-60&app_name=python_wrapper&app_version=2.6.0&top=5
31112995
response:
31122996
body:
3113-
string: '{"timestamp":"2025-10-22T10:52:26Z","domain":"campredemption.com"}
2997+
string: '{"timestamp":"2025-10-23T18:32:45Z","domain":"lahntonaci.de"}
31142998
3115-
{"timestamp":"2025-10-22T10:52:26Z","domain":"mahkota77.sbs"}
2999+
{"timestamp":"2025-10-23T18:32:45Z","domain":"wildeland-ventures.com"}
31163000
3117-
{"timestamp":"2025-10-22T10:52:25Z","domain":"kylothedogebnb.fun"}
3001+
{"timestamp":"2025-10-23T18:32:45Z","domain":"elartesanal.com.gt"}
31183002
3119-
{"timestamp":"2025-10-22T10:52:25Z","domain":"schwab-secure93.wiki"}
3003+
{"timestamp":"2025-10-23T18:32:45Z","domain":"5movierulz2.blue"}
31203004
3121-
{"timestamp":"2025-10-22T10:52:25Z","domain":"ok08.cc"}
3005+
{"timestamp":"2025-10-23T18:32:45Z","domain":"airplanepilotsupport.com"}
31223006
31233007
'
31243008
headers:
31253009
Cache-Control:
31263010
- no-store, no-cache, must-revalidate
31273011
Content-Length:
3128-
- '321'
3012+
- '338'
31293013
Content-Security-Policy:
31303014
- 'default-src * data: blob: ''unsafe-eval'' ''unsafe-inline'''
31313015
Content-Type:
31323016
- application/x-ndjson
31333017
Date:
3134-
- Wed, 22 Oct 2025 10:52:27 GMT
3018+
- Thu, 23 Oct 2025 18:32:45 GMT
31353019
Expires:
31363020
- Thu, 19 Nov 1981 08:52:00 GMT
31373021
Pragma:
31383022
- no-cache
31393023
Set-Cookie:
3140-
- dtsession=nd7k8vjf050qnsmprlcu9iedq156h2slia8fg4qa2d72h2bsfrvgd22qufudnh9u02233jg6k0k3lrmec2klf0rhg8ingdt9v2vs7fr;
3141-
expires=Fri, 21-Nov-2025 10:52:27 GMT; Max-Age=2592000; path=/; domain=.domaintools.com;
3024+
- dtsession=qe90675g75jckqeks6pbr4su7h2i0iul83l3r7gqcoi7jmlt6cj909gha30fmcajg3avge6ao00usmpdd7h6lsvqe22j6cv4n0vemts;
3025+
expires=Sat, 22-Nov-2025 18:32:45 GMT; Max-Age=2592000; path=/; domain=.domaintools.com;
31423026
secure; HttpOnly
3143-
- 0566fae076d9b6615cd8f47a9e9500f2=acfc58822336225f812eb799691c0d9e; path=/;
3027+
- 0566fae076d9b6615cd8f47a9e9500f2=4556b46b52fb2ae62de3b26ddc27dfa0; path=/;
31443028
HttpOnly
31453029
Strict-Transport-Security:
31463030
- max-age=31536000; includeSubDomains
31473031
X-Request-Id:
3148-
- a88466ad-c0e4-420c-ae51-7aebc8c97deb
3032+
- 4fbb1620-8c58-49f3-8f25-9523323808f8
31493033
status:
31503034
code: 200
31513035
message: OK

0 commit comments

Comments
 (0)