mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
fix: [cves] catch cve search errors
This commit is contained in:
parent
f4d20533cc
commit
98cbaad1ad
2 changed files with 64 additions and 57 deletions
|
@ -76,6 +76,7 @@ class Cve(AbstractDaterangeObject):
|
|||
self._add(date, item_id)
|
||||
|
||||
def get_cve_search(self):
|
||||
try:
|
||||
response = requests.get(f'https://cvepremium.circl.lu/api/cve/{self.id}', timeout=10)
|
||||
if response.status_code == 200:
|
||||
json_response = response.json()
|
||||
|
@ -87,6 +88,9 @@ class Cve(AbstractDaterangeObject):
|
|||
return json_response
|
||||
else:
|
||||
return {'error': f'{response.status_code}'}
|
||||
except requests.exceptions.ConnectionError:
|
||||
return {'error': f'Connection Error'}
|
||||
|
||||
|
||||
# TODO ADD SEARCH FUNCTION
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
</div>
|
||||
</li>
|
||||
{% 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">
|
||||
<table class="table table-sm table-hover">
|
||||
<tbody>
|
||||
|
@ -97,7 +100,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li class="list-group-item py-0">
|
||||
<br>
|
||||
|
|
Loading…
Reference in a new issue