mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-15 21:54:59 +00:00
Make ratilimits never have a None value
This commit is contained in:
parent
0f1056a2af
commit
ddc5934a13
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue