diff --git a/pyvulnerabilitylookup/api.py b/pyvulnerabilitylookup/api.py index b8969dd..1bc6003 100644 --- a/pyvulnerabilitylookup/api.py +++ b/pyvulnerabilitylookup/api.py @@ -11,10 +11,13 @@ import requests class PyVulnerabilityLookup(): - def __init__(self, root_url: str, useragent: Optional[str]=None): + def __init__(self, root_url: str, useragent: Optional[str]=None, + *, proxies: Optional[Dict[str, str]]=None): '''Query a specific instance. :param root_url: URL of the instance to query. + :param useragent: The User Agent used by requests to run the HTTP requests against the vulnerability lookup instance + :param proxies: The proxies to use to connect to the vulnerability lookup instance - More details: https://requests.readthedocs.io/en/latest/user/advanced/#proxies ''' self.root_url = root_url @@ -24,6 +27,8 @@ class PyVulnerabilityLookup(): self.root_url += '/' self.session = requests.session() self.session.headers['user-agent'] = useragent if useragent else f'PyProject / {version("pyvulnerabilitylookup")}' + if proxies: + self.session.proxies.update(proxies) @property def is_up(self) -> bool: