Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion massive/rest/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import certifi
import json
import os
import urllib3
import inspect
from urllib3.util.retry import Retry
Expand Down Expand Up @@ -70,14 +71,22 @@ def __init__(

# https://urllib3.readthedocs.io/en/stable/reference/urllib3.poolmanager.html
# https://urllib3.readthedocs.io/en/stable/reference/urllib3.connectionpool.html#urllib3.HTTPConnectionPool
self.client = urllib3.PoolManager(
pool_kwargs = dict(
num_pools=num_pools,
headers=self.headers, # default headers sent with each request.
ca_certs=certifi.where(),
cert_reqs="CERT_REQUIRED",
retries=retry_strategy, # use the customized Retry instance
)

# Check for proxy environment variables (HTTPS_PROXY or HTTP_PROXY)
proxy_url = os.environ.get("HTTPS_PROXY") or os.environ.get("https_proxy") \
or os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy")
if proxy_url:
self.client = urllib3.ProxyManager(proxy_url, **pool_kwargs)
else:
self.client = urllib3.PoolManager(**pool_kwargs)

self.timeout = urllib3.Timeout(connect=connect_timeout, read=read_timeout)

if verbose:
Expand Down
Loading