Skip to content

Commit

Permalink
Provide methods for closing and create the httpx session in AsyncFire…
Browse files Browse the repository at this point in the history
…crest
  • Loading branch information
ekouts committed Apr 3, 2024
1 parent 3a197ca commit 921f87d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions firecrest/AsyncClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ def set_api_version(self, api_version: str) -> None:
"""
self._api_version = parse(api_version)

async def close_session(self) -> None:
"""Close the httpx session"""
await self._session.aclose()

async def create_new_session(self) -> None:
"""Create a new httpx session"""
if not self._session.is_closed:
await self._session.aclose()

self._session = httpx.AsyncClient()

@_retry_requests # type: ignore
async def _get_request(
self, endpoint, additional_headers=None, params=None
Expand Down

0 comments on commit 921f87d

Please sign in to comment.