Skip to content

Commit

Permalink
Take into account the verify argument in the async client (#108)
Browse files Browse the repository at this point in the history
* Take into account verify argument in the async client

* Fix types

* Set the correct verify type
  • Loading branch information
ekouts authored Jun 4, 2024
1 parent de0fb1a commit 6bd099d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions firecrest/AsyncClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import pathlib
import requests
import ssl
import sys
import tempfile
import time
Expand Down Expand Up @@ -154,15 +155,15 @@ def __init__(
self,
firecrest_url: str,
authorization: Any,
verify: Optional[str | bool] = None,
verify: str | bool | ssl.SSLContext = True,
sa_role: str = "firecrest-sa",
) -> None:
self._firecrest_url = firecrest_url
self._authorization = authorization
# This should be used only for blocking operations that require multiple requests,
# not for external upload/download
self._current_method_requests: List[requests.Response] = []
self._verify = verify # TODO: not supported in httpx
self._verify = verify
self._sa_role = sa_role
#: This attribute will be passed to all the requests that will be made.
#: How many seconds to wait for the server to send data before giving up.
Expand All @@ -182,7 +183,7 @@ def __init__(
#: `tasks` microservice.
self.polling_sleep_times: list = 250 * [0]
self._api_version: Version = parse("1.13.1")
self._session = httpx.AsyncClient()
self._session = httpx.AsyncClient(verify=self._verify)

#: Seconds between requests in each microservice
self.time_between_calls: dict[str, float] = { # TODO more detailed docs
Expand Down Expand Up @@ -234,7 +235,7 @@ async def create_new_session(self) -> None:
if not self._session.is_closed:
await self._session.aclose()

self._session = httpx.AsyncClient()
self._session = httpx.AsyncClient(verify=self._verify)

@property
def is_session_closed(self) -> bool:
Expand Down

0 comments on commit 6bd099d

Please sign in to comment.