Skip to content

Commit 0f39d9b

Browse files
authored
Merge pull request #111 from DomainTools/origin/id-1544-fix-proxy-support
Origin/id 1544 fix proxy support
2 parents b912f65 + 324eaf5 commit 0f39d9b

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ venv/
7272

7373
# Cython
7474
*.c
75+
76+
# Testing folders
77+
proxyTest/

domaintools/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, username, key, https=True, verify_ssl=True, rate_limit=True,
5757
raise Exception("The DomainTools API endpoints no longer support http traffic. Please make sure https=True.")
5858
if proxy_url:
5959
if isinstance(proxy_url, str):
60-
self.extra_request_params['proxies'] = {'http': proxy_url, 'https': proxy_url}
60+
self.proxy_url = {'http://': proxy_url, 'https://': proxy_url}
6161
else:
6262
raise Exception("Proxy URL must be a string. For example: '127.0.0.1:8888'")
6363

domaintools/base_results.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def _wait_time(self):
5757
return wait_for
5858

5959
def _make_request(self):
60-
with Client(verify=self.api.verify_ssl, proxies=self.api.extra_request_params.get('proxies'), timeout=None) as session:
60+
61+
with Client(verify=self.api.verify_ssl, proxies=self.api.proxy_url, timeout=None) as session:
6162
if self.product in ['iris-investigate', 'iris-enrich', 'iris-detect-escalate-domains']:
6263
post_data = self.kwargs.copy()
6364
post_data.update(self.api.extra_request_params)

domaintools_async/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ async def _make_async_request(self, session):
5959

6060
async def __awaitable__(self):
6161
if self._data is None:
62-
async with AsyncClient(verify=self.api.verify_ssl, proxies=self.api.extra_request_params.get('proxies'), timeout=None) as session:
62+
63+
async with AsyncClient(verify=self.api.verify_ssl, proxies=self.api.proxy_url, timeout=None) as session:
6364
wait_time = self._wait_time()
6465
if wait_time is None and self.api:
6566
try:

0 commit comments

Comments
 (0)