mirror of
https://github.com/cve-search/PyVulnerabilityLookup.git
synced 2024-11-25 08:17:20 +00:00
new: Auto retry on HTTP requests
Some checks failed
Python application - MyPy / Python 3.12 sample (push) Has been cancelled
Python application - MyPy / Python 3.13 sample (push) Has been cancelled
Python application - MyPy / Python 3.10 sample (push) Has been cancelled
Python application - MyPy / Python 3.11 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.10 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.11 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.12 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.13 sample (push) Has been cancelled
Some checks failed
Python application - MyPy / Python 3.12 sample (push) Has been cancelled
Python application - MyPy / Python 3.13 sample (push) Has been cancelled
Python application - MyPy / Python 3.10 sample (push) Has been cancelled
Python application - MyPy / Python 3.11 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.10 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.11 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.12 sample (push) Has been cancelled
Python application - Test Public Interface / Python 3.13 sample (push) Has been cancelled
This commit is contained in:
parent
bd1684e2c3
commit
46b322ff43
1 changed files with 5 additions and 1 deletions
|
@ -13,6 +13,9 @@ from urllib.parse import urljoin, urlparse
|
|||
|
||||
import requests
|
||||
|
||||
from urllib3.util import Retry
|
||||
from requests.adapters import HTTPAdapter
|
||||
|
||||
|
||||
def enable_full_debug() -> None:
|
||||
import http.client as http_client
|
||||
|
@ -47,7 +50,8 @@ class PyVulnerabilityLookup():
|
|||
self.session.headers['Content-Type'] = 'application/json'
|
||||
if proxies:
|
||||
self.session.proxies.update(proxies)
|
||||
self.session.request = functools.partial(self.session.request, timeout=10)
|
||||
retries = Retry(total=5, backoff_factor=1, status_forcelist=[500, 502, 503, 504])
|
||||
self.session.mount('https://', HTTPAdapter(max_retries=retries))
|
||||
|
||||
def set_apikey(self, apikey: str) -> None:
|
||||
'''Set the API key to use for the requests'''
|
||||
|
|
Loading…
Reference in a new issue