1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-30 20:48:12 +00:00

Fix response type in WillExceedRatelimit

This commit is contained in:
NextChai 2022-04-30 02:39:44 -04:00
parent 80c06c56f7
commit 6488286a05

View file

@ -1,10 +1,8 @@
# == exceptions.py ==# # == exceptions.py ==#
import datetime import datetime
from typing import TYPE_CHECKING
if TYPE_CHECKING: from aiohttp import ClientResponse
from aiohttp import ClientRequest
__all__ = ( __all__ = (
'APIError', 'APIError',
@ -69,7 +67,7 @@ class Ratelimited(APIError):
class WillExceedRatelimit(APIError): class WillExceedRatelimit(APIError):
"""Raised when the library predicts the call will exceed the ratelimit, will abort the call by default.""" """Raised when the library predicts the call will exceed the ratelimit, will abort the call by default."""
def __init__(self, response: ClientRequest, count: int): def __init__(self, response: ClientResponse, count: int):
msg = 'Performing this action will exceed the ratelimit, aborting.\n{} remaining available calls, calls to make: {}.' msg = 'Performing this action will exceed the ratelimit, aborting.\n{} remaining available calls, calls to make: {}.'
msg = msg.format(response.headers['X-RateLimit-Remaining'], count) msg = msg.format(response.headers['X-RateLimit-Remaining'], count)
super().__init__(msg) super().__init__(msg)