diff --git a/src/simple_github/auth.py b/src/simple_github/auth.py index b1c2030..3d56461 100644 --- a/src/simple_github/auth.py +++ b/src/simple_github/auth.py @@ -18,6 +18,10 @@ async def get_token(self) -> str: """Returns""" ... + async def close(self) -> None: + """Close the authentication if necessary.""" + pass + class TokenAuth(Auth): def __init__(self, token): @@ -115,6 +119,10 @@ def __init__( self._client = Client(auth=self.app) self._generator = self._gen_installation_token() + async def close(self) -> None: + """Close the Client used to fetch the installation token.""" + await self._client.close() + async def _get_installation_id(self) -> str: """Return the app's installation id for owner. diff --git a/src/simple_github/client.py b/src/simple_github/client.py index 307833d..4aee054 100644 --- a/src/simple_github/client.py +++ b/src/simple_github/client.py @@ -39,6 +39,7 @@ async def __aexit__(self, *excinfo): await self.close() async def close(self) -> None: + await self.auth.close() if self._gql_client: await self._gql_client.close_async()