mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-26 15:57:16 +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)
|
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 a new issue