mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-19 23:45:09 +00:00
Fix http.data
This commit is contained in:
parent
98545347b6
commit
b96305f681
2 changed files with 11 additions and 5 deletions
|
@ -163,10 +163,17 @@ class http:
|
||||||
def data(self):
|
def data(self):
|
||||||
#return session headers and auth
|
#return session headers and auth
|
||||||
headers = {**self.session.headers}
|
headers = {**self.session.headers}
|
||||||
auth = {'username': self.auth.login, 'token': self.auth.password}
|
if self.auth:
|
||||||
|
auth = {'username': self.auth.login, 'token': self.auth.password}
|
||||||
|
auth = None
|
||||||
return {'headers': headers, 'auth': auth}
|
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:
|
async def get_self(self) -> GithubUserData:
|
||||||
"""Returns the authenticated User's data"""
|
"""Returns the authenticated User's data"""
|
||||||
result = await self.session.get(SELF_URL)
|
result = await self.session.get(SELF_URL)
|
||||||
|
|
|
@ -155,9 +155,8 @@ class GHClient:
|
||||||
|
|
||||||
async def latency(self) -> float:
|
async def latency(self) -> float:
|
||||||
"""Returns the latency of the client."""
|
"""Returns the latency of the client."""
|
||||||
start = datetime.utcnow()
|
return await self.http.latency()
|
||||||
await self.http.session.get(BASE_URL + '/zen')
|
|
||||||
return (datetime.utcnow() - start).total_seconds()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue