1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-19 15:35:08 +00:00

might fix?

This commit is contained in:
VarMonke 2022-04-27 15:15:58 +05:30
parent a769769b77
commit 98545347b6

View file

@ -8,7 +8,7 @@ __all__ = (
import asyncio
import functools
from typing import Union, List
from typing import Union, List, Dict
import aiohttp
@ -16,7 +16,7 @@ from . import exceptions
from .cache import RepoCache, UserCache
from .http import http
from .objects import Gist, Issue, Organization, Repository, User, File
from Github.urls import BASE_URL
from .urls import BASE_URL
class GHClient:
@ -107,12 +107,6 @@ class GHClient:
return wrapped
return wrapper
async def latency(self) -> int:
"""Returns the latency of the client."""
start = datetime.utcnow()
await self.http.session.get(BASE_URL + '/zen')
return (datetime.utcnow() - start).total_seconds()
#@_cache(type='User')
async def get_self(self) -> User:
"""Returns the authenticated User object."""
@ -159,5 +153,11 @@ class GHClient:
"""Fetch a Github organization from it's name."""
return Organization(await self.http.get_org(org), self.http.session)
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()