1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-17 06:25:10 +00:00

Fixed walrus

This commit is contained in:
sudosnok 2022-05-01 20:14:40 +01:00
parent 8f5780ce24
commit 04bdadc995

View file

@ -102,6 +102,12 @@ class GHClient:
return self
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
try:
session = self.http.session
await self.session.close()
except Exception as exc:
raise Exception('HTTP Session doesn\'t exist') from exc
if session := getattr(self.http, 'session', None):
await session.close()