mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
github & gitlab: exc.response may be None when timed out
This commit is contained in:
parent
9b8cfc6f6f
commit
be6f9dc9e9
2 changed files with 8 additions and 1 deletions
|
@ -122,6 +122,9 @@ def get_next_page_url(links):
|
|||
|
||||
def check_ratelimit(exc, name):
|
||||
res = exc.response
|
||||
if not res:
|
||||
raise
|
||||
|
||||
# default -1 is used to re-raise the exception
|
||||
n = int(res.headers.get('X-RateLimit-Remaining', -1))
|
||||
if n == 0:
|
||||
|
|
|
@ -62,7 +62,11 @@ async def get_version_real(name, conf, **kwargs):
|
|||
|
||||
def check_ratelimit(exc, name):
|
||||
res = exc.response
|
||||
n = int(res.headers.get('RateLimit-Remaining'))
|
||||
if not res:
|
||||
raise
|
||||
|
||||
# default -1 is used to re-raise the exception
|
||||
n = int(res.headers.get('RateLimit-Remaining'), -1)
|
||||
if n == 0:
|
||||
logger.error('rate limited, resetting at (unknown). '
|
||||
'Or get an API token to increase the allowance if not yet',
|
||||
|
|
Loading…
Add table
Reference in a new issue