diff --git a/docs/usage.rst b/docs/usage.rst index 1cc2049..78a5124 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -177,8 +177,9 @@ tries This only works when the source implementation uses the builtin HTTP client. httptoken - A personal authorization token used to call the url. The type of token depends on the authorization required. - + A personal authorization token used to fetch the url with the ``Authorization`` header. + The type of token depends on the authorization required. + - For Bearer token set : ``Bearer `` - For Basic token set : ``Basic `` @@ -282,7 +283,10 @@ url The URL of the HTTP request. xpath - A xpath expression used to find the version string + An xpath expression used to find the version string. + +.. note:: + An additional dependency "lxml" is required Find with a Command ~~~~~~~~~~~~~~~~~~~ diff --git a/nvchecker/util.py b/nvchecker/util.py index 25c14f1..0181d52 100644 --- a/nvchecker/util.py +++ b/nvchecker/util.py @@ -226,12 +226,11 @@ class FunctionWorker(BaseWorker): if ua is not None: ctx_ua.set(ua) httpt = entry.get('httptoken', None) - if httpt is not None: - ctx_httpt.set(httpt) - else: + if httpt is None: httpt = self.keymanager.get_key('httptoken_'+name) - if httpt is not None: + if httpt is not None: ctx_httpt.set(httpt) + try: async with self.task_sem: version = await self.func( diff --git a/nvchecker_source/htmlparser.py b/nvchecker_source/htmlparser.py index 96f1767..a64f213 100644 --- a/nvchecker_source/htmlparser.py +++ b/nvchecker_source/htmlparser.py @@ -2,8 +2,6 @@ # Copyright (c) 2020 Ypsilik , et al. # Copyright (c) 2013-2020 lilydjwg , et al. -import re -import sre_constants from lxml import html, etree from nvchecker.api import session, GetVersionError