mirror of https://github.com/CIRCL/AIL-framework
fix: [cves] catch cve search errors
parent
f4d20533cc
commit
98cbaad1ad
|
@ -76,6 +76,7 @@ class Cve(AbstractDaterangeObject):
|
||||||
self._add(date, item_id)
|
self._add(date, item_id)
|
||||||
|
|
||||||
def get_cve_search(self):
|
def get_cve_search(self):
|
||||||
|
try:
|
||||||
response = requests.get(f'https://cvepremium.circl.lu/api/cve/{self.id}', timeout=10)
|
response = requests.get(f'https://cvepremium.circl.lu/api/cve/{self.id}', timeout=10)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
json_response = response.json()
|
json_response = response.json()
|
||||||
|
@ -87,6 +88,9 @@ class Cve(AbstractDaterangeObject):
|
||||||
return json_response
|
return json_response
|
||||||
else:
|
else:
|
||||||
return {'error': f'{response.status_code}'}
|
return {'error': f'{response.status_code}'}
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
return {'error': f'Connection Error'}
|
||||||
|
|
||||||
|
|
||||||
# TODO ADD SEARCH FUNCTION
|
# TODO ADD SEARCH FUNCTION
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% if dict_object["metadata_card"]["cve_search"] %}
|
{% if dict_object["metadata_card"]["cve_search"] %}
|
||||||
|
{% if 'error' in dict_object["metadata_card"]["cve_search"] %}
|
||||||
|
<b class="text-danger my-2"><i class="fas fa-exclamation-triangle"></i> CVE Search Error: {{ dict_object["metadata_card"]["cve_search"]["error"] }}</b>
|
||||||
|
{% else %}
|
||||||
<li class="list-group-item py-0">
|
<li class="list-group-item py-0">
|
||||||
<table class="table table-sm table-hover">
|
<table class="table table-sm table-hover">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -97,7 +100,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="list-group-item py-0">
|
<li class="list-group-item py-0">
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in New Issue