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

Make ratilimits never have a None value

This commit is contained in:
RGBCube 2022-07-01 15:08:36 +03:00
parent 0f1056a2af
commit ddc5934a13

View file

@ -38,8 +38,8 @@ class RateLimits(NamedTuple):
remaining: int remaining: int
used: int used: int
total: int total: int
reset_time: Optional[datetime] reset_time: datetime
last_request: Optional[datetime] last_request: datetime
# ====== STYLE GUIDE ===== # # ====== STYLE GUIDE ===== #
@ -119,7 +119,7 @@ class HTTPClient:
*, *,
headers: Optional[Dict[str, str]] = None, headers: Optional[Dict[str, str]] = None,
auth: Optional[BasicAuth] = None, auth: Optional[BasicAuth] = None,
) -> Self: ) -> HTTPClient:
self = super(cls, cls).__new__(cls) self = super(cls, cls).__new__(cls)
headers = headers or {} headers = headers or {}
@ -132,7 +132,9 @@ class HTTPClient:
self.__session = ClientSession(headers=headers, auth=auth) self.__session = ClientSession(headers=headers, auth=auth)
self._rates = RateLimits(60, 0, 60, None, None) time_0 = datetime.fromtimestamp(0)
self._rates = RateLimits(60, 0, 60, time_0, time_0)
self._last_ping = float("-inf") self._last_ping = float("-inf")
self._latency = 0 self._latency = 0