Skip to content

Commit

Permalink
Revert "Use ssl_context for HTTPS requests to avoid reading certifica…
Browse files Browse the repository at this point in the history
…te files…" (#691)

This reverts commit 7cb5208.
  • Loading branch information
justinpolygon authored Jul 2, 2024
1 parent 479cca3 commit f789d29
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions polygon/rest/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import certifi
import json
import ssl
import urllib3
import inspect
from urllib3.util.retry import Retry
Expand Down Expand Up @@ -67,16 +66,13 @@ def __init__(
backoff_factor=0.1, # [0.0s, 0.2s, 0.4s, 0.8s, 1.6s, ...]
)

# global cache ssl context and use (vs on each init of pool manager)
ssl_context = ssl.create_default_context()
ssl_context.load_verify_locations(certifi.where())

# 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(
num_pools=num_pools,
headers=self.headers, # default headers sent with each request.
ssl_context=ssl_context,
ca_certs=certifi.where(),
cert_reqs="CERT_REQUIRED",
retries=retry_strategy, # use the customized Retry instance
)

Expand Down

0 comments on commit f789d29

Please sign in to comment.