1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-17 14:35:09 +00:00

Adding user object

Editing Exceptions and changing _state to session
This commit is contained in:
VarMonke 2022-03-27 11:03:47 +05:30
parent 25710629f2
commit 77de27ea5a
3 changed files with 40 additions and 11 deletions

View file

@ -12,7 +12,7 @@ from .objects import User
class Github:
_auth = None
_state = aiohttp.ClientSession
session = aiohttp.ClientSession
def __init__(
self,
*,
@ -28,8 +28,8 @@ class Github:
async def start(self):
"""Main entry point to the wrapper, this creates the ClientSession."""
self._state = await http.make_session(headers=self._headers, authorization=self._auth)
self.session = await http.make_session(headers=self._headers, authorization=self._auth)
async def get_user(self, username: str):
"""Fetch a Github user from their username."""
return User(await http.get_user(self._state, username), self._state)
return User(await http.get_user(self.session, username), self.session)