Skip to content

Commit

Permalink
Don't create SSL context at import time (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
thenno authored Nov 3, 2023
1 parent f461898 commit 24c1031
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/dl_core/dl_core/united_storage_client_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def json(self) -> dict:
return self._request_data.json # type: ignore # TODO: fix

_session: aiohttp.ClientSession
DEFAULT_SSL_CONTEXT = ssl.create_default_context(cafile=get_root_certificates_path())

def __init__(
self,
Expand All @@ -129,9 +128,11 @@ def __init__(
self._retry_intervals = (0.5, 1.0, 1.1, 2.0, 2.2)
self._retry_codes = {408, 429, 500, 502, 503, 504}

ssl_context = ssl.create_default_context(cafile=get_root_certificates_path())

self._session = aiohttp.ClientSession(
cookies=self._cookies,
connector=aiohttp.TCPConnector(ssl_context=self.DEFAULT_SSL_CONTEXT),
connector=aiohttp.TCPConnector(ssl_context=ssl_context),
headers={
**self._default_headers,
},
Expand Down

0 comments on commit 24c1031

Please sign in to comment.