You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(f"The option 'force_cached_or_offline' was used, but {cve_id} not found in {CVE_CACHE_FILENAME} and unable to connect to {CVESSEARCH_API_URL}: {str(e)}")
45
-
print(f"Retrying the CVESearch API up to {api_attempts_remaining} more times after a sleep of {retry_sleep_seconds} seconds...")
46
-
time.sleep(retry_sleep_seconds)
47
-
else:
48
-
raise(Exception(f"The option 'force_cached_or_offline' was used, but {cve_id} not found in {CVE_CACHE_FILENAME} and unable to connect to {CVESSEARCH_API_URL} after {max_api_attempts} attempts: {str(e)}"))
49
-
50
-
ifresultisNone:
51
-
raise(Exception(f'CveEnrichment for [ {cve_id} ] failed - CVE does not exist'))
52
-
cache[cve_id] =result
53
-
54
-
ifisinstance(cache, shelve.Shelf):
55
-
#close the cache if it was a shelf
56
-
cache.close()
10
+
fromrequests.exceptionsimportReadTimeout
57
11
58
-
returnresult
12
+
ifTYPE_CHECKING:
13
+
fromcontentctl.objects.configimportvalidate
59
14
60
-
@functools.cache
61
-
defcvesearch_id_helper(url:str):
62
-
#The initial CVESearch call takes some time.
63
-
#We cache it to avoid making this call each time we need to do a lookup
64
-
cve=CVESearch(CVESSEARCH_API_URL)
65
-
returncve
66
15
67
16
17
+
CVESSEARCH_API_URL='https://cve.circl.lu'
68
18
69
19
70
20
classCveEnrichmentObj(BaseModel):
@@ -74,27 +24,74 @@ class CveEnrichmentObj(BaseModel):
raiseValueError(f"Error, field 'mitre_attack_enrichment' should be empty and dynamically populated at runtime. Instead, this field contained: {str(v)}")
148
+
raiseValueError(f"Error, field 'mitre_attack_enrichment' should be empty and dynamically populated at runtime. Instead, this field contained: {self.mitre_attack_enrichments}")
0 commit comments