1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-20 07:55:09 +00:00

Fix http.data

This commit is contained in:
VarMonke 2022-04-27 17:03:32 +05:30
parent 98545347b6
commit b96305f681
2 changed files with 11 additions and 5 deletions

View file

@ -163,10 +163,17 @@ class http:
def data(self):
#return session headers and auth
headers = {**self.session.headers}
if self.auth:
auth = {'username': self.auth.login, 'token': self.auth.password}
auth = None
return {'headers': headers, 'auth': auth}
async def latency(self):
"""Returns the latency of the current session."""
start = datetime.utcnow()
await self.session.get(BASE_URL)
return (datetime.utcnow() - start).total_seconds()
async def get_self(self) -> GithubUserData:
"""Returns the authenticated User's data"""
result = await self.session.get(SELF_URL)

View file

@ -155,9 +155,8 @@ class GHClient:
async def latency(self) -> float:
"""Returns the latency of the client."""
start = datetime.utcnow()
await self.http.session.get(BASE_URL + '/zen')
return (datetime.utcnow() - start).total_seconds()
return await self.http.latency()