Skip to content

Commit

Permalink
added verify ssl flag to client
Browse files Browse the repository at this point in the history
  • Loading branch information
Rutger Cappendijk committed Nov 16, 2023
1 parent e90fa62 commit 8aa3cd0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aleph_alpha_client/aleph_alpha_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(
request_timeout_seconds: int = DEFAULT_REQUEST_TIMEOUT,
total_retries: int = 8,
nice: bool = False,
verify_ssl = True,
) -> None:
if host[-1] != "/":
host += "/"
Expand All @@ -163,6 +164,7 @@ def __init__(
)
adapter = HTTPAdapter(max_retries=retry_strategy)
self.session = requests.Session()
self.session.verify = verify_ssl
self.session.headers = CaseInsensitiveDict(
{
"Authorization": "Bearer " + self.token,
Expand Down Expand Up @@ -600,6 +602,7 @@ def __init__(
request_timeout_seconds: int = DEFAULT_REQUEST_TIMEOUT,
total_retries: int = 8,
nice: bool = False,
verify_ssl = True,
) -> None:
if host[-1] != "/":
host += "/"
Expand All @@ -615,6 +618,7 @@ def __init__(
start_timeout=0.25,
statuses=set(RETRY_STATUS_CODES),
)
connector = aiohttp.TCPConnector(ssl=verify_ssl)
self.session = RetryClient(
trust_env=True, # same behaviour as requests/(Sync)Client wrt. http_proxy
raise_for_status=False,
Expand All @@ -625,6 +629,7 @@ def __init__(
"User-Agent": "Aleph-Alpha-Python-Client-"
+ aleph_alpha_client.__version__,
},
connector=connector
)

async def close(self):
Expand Down

0 comments on commit 8aa3cd0

Please sign in to comment.