fix: #137 when a CVE is not found, a return message is given

pull/144/head
Alexandre Dulaunoy 2017-10-21 19:52:19 +02:00
parent 2f6406b1e5
commit 03baa0b84d
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 5 additions and 2 deletions

View File

@ -19,8 +19,11 @@ def handler(q=False):
r = requests.get(cveapi_url + request.get('vulnerability'))
if r.status_code == 200:
vulnerability = json.loads(r.text)
if vulnerability.get('summary'):
summary = vulnerability['summary']
if vulnerability:
if vulnerability.get('summary'):
summary = vulnerability['summary']
else:
summary = 'Non existing CVE'
else:
misperrors['error'] = 'cve.circl.lu API not accessible'
return misperrors['error']