Skip to content

Commit

Permalink
Merge pull request #129 from SecPascal/patch-1
Browse files Browse the repository at this point in the history
Update utils.py to use urllib3.ProxyManager
  • Loading branch information
wimglenn committed Dec 7, 2023
2 parents e22d192 + 5e57bcd commit 34d73e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aocd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ class HttpClient:
# aocd users should not need to use this class directly.

def __init__(self):
self.pool_manager = urllib3.PoolManager(headers={"User-Agent": USER_AGENT})

proxy_url = os.environ.get('http_proxy') or os.environ.get('https_proxy')
if proxy_url:
self.pool_manager = urllib3.ProxyManager(proxy_url, headers={"User-Agent": USER_AGENT})
else:
self.pool_manager = urllib3.PoolManager(headers={"User-Agent": USER_AGENT})
self.req_count = {"GET": 0, "POST": 0}
self._max_t = 3.0
self._cooloff = 0.16
Expand Down

0 comments on commit 34d73e3

Please sign in to comment.