Skip to content

Commit

Permalink
Fix cartography-cncf#1326: update CVE request timeouts (cartography-c…
Browse files Browse the repository at this point in the history
  • Loading branch information
achantavy authored and chandanchowdhury committed Nov 27, 2024
1 parent 7e4b86a commit 5e643b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cartography/intel/cve/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
logger = logging.getLogger(__name__)

MAX_RETRIES = 3
REQUEST_TIMEOUT = 10
# Connect and read timeouts of 60 seconds each; see https://requests.readthedocs.io/en/master/user/advanced/#timeouts
CONNECT_AND_READ_TIMEOUT = (60, 60)
CVE_FEED_ID = "NIST_NVD"
BATCH_SIZE_DAYS = 120
RESULTS_PER_PAGE = 2000
Expand Down Expand Up @@ -87,7 +88,7 @@ def _call_cves_api(url: str, api_key: str, params: Dict[str, Any]) -> Dict[Any,
while params["resultsPerPage"] > 0 or params["startIndex"] < totalResults:
try:
res = requests.get(
url, params=params, headers=headers, timeout=REQUEST_TIMEOUT,
url, params=params, headers=headers, timeout=CONNECT_AND_READ_TIMEOUT,
)
res.raise_for_status()
except requests.exceptions.HTTPError:
Expand Down

0 comments on commit 5e643b1

Please sign in to comment.