diff --git a/github/errors.py b/github/errors.py index abb9f1c..73f7d44 100644 --- a/github/errors.py +++ b/github/errors.py @@ -47,6 +47,7 @@ class RatelimitReached(GitHubError): f" {human_readable_time_until(datetime.now(timezone.utc) - self.reset_time)}" ) + def error_from_request(request: ClientResponse, /) -> BaseHTTPError: # TODO: Make specific errrors return HTTPError(request) diff --git a/github/internals/http.py b/github/internals/http.py index b264078..50e3f6d 100644 --- a/github/internals/http.py +++ b/github/internals/http.py @@ -11,8 +11,8 @@ from typing import TYPE_CHECKING, Any, Awaitable, Dict, List, Literal, NamedTupl from aiohttp import ClientSession, TraceConfig, __version__ as aiohttp_verrsion -from ..utils import human_readable_time_until from ..errors import error_from_request +from ..utils import human_readable_time_until if TYPE_CHECKING: from types import SimpleNamespace @@ -23,6 +23,7 @@ if TYPE_CHECKING: from ..objects import File from ..types import SecurtiyAndAnalysis + log = logging.getLogger("github") diff --git a/github/utils.py b/github/utils.py index 3313dd7..a7bf118 100644 --- a/github/utils.py +++ b/github/utils.py @@ -14,10 +14,6 @@ from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from datetime import datetime, timedelta - from aiohttp import ClientResponse - - from .errors import BaseHTTPError - def human_readable_time_until(td: timedelta, /) -> str: seconds = int(td.total_seconds())