diff --git a/firecrest/AsyncClient.py b/firecrest/AsyncClient.py index e518bb3..47415ea 100644 --- a/firecrest/AsyncClient.py +++ b/firecrest/AsyncClient.py @@ -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