diff --git a/nvchecker/get_version.py b/nvchecker/get_version.py index 96be522..b8a75b5 100644 --- a/nvchecker/get_version.py +++ b/nvchecker/get_version.py @@ -42,13 +42,16 @@ async def get_version(name, conf, **kwargs): for key in handler_precedence: if key in conf: func = import_module('.source.' + key, __package__).get_version - version = await func(name, conf, **kwargs) - if version: - version = version.replace('\n', ' ') - try: - version = substitute_version(version, name, conf) - except (ValueError, re.error): - logger.exception('error occurred in version substitutions', name=name) - return version + break else: logger.error('no idea to get version info.', name=name) + return + + version = await func(name, conf, **kwargs) + if version: + version = version.replace('\n', ' ') + try: + version = substitute_version(version, name, conf) + except (ValueError, re.error): + logger.exception('error occurred in version substitutions', name=name) + return version diff --git a/nvchecker/source/gitlab.py b/nvchecker/source/gitlab.py index 4674b3a..9c79ce7 100644 --- a/nvchecker/source/gitlab.py +++ b/nvchecker/source/gitlab.py @@ -2,7 +2,6 @@ # Copyright (c) 2013-2018 lilydjwg , et al. import os -import time import urllib.parse import structlog @@ -66,7 +65,7 @@ def check_ratelimit(exc, name): raise # default -1 is used to re-raise the exception - n = int(res.headers.get('RateLimit-Remaining'), -1) + 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',