fix: [expansion:virus_total] Capture `ForbiddenError` from vr.APIError correctly

pull/700/head
Sami Mokaddem 2024-09-03 11:13:41 +02:00
parent 55b0914185
commit 28390ac9ae
1 changed files with 4 additions and 1 deletions

View File

@ -286,7 +286,10 @@ def dict_handler(request: dict):
parser = VirusTotalParser(client, int(event_limit) if event_limit else None)
parser.query_api(attribute)
except vt.APIError as ex:
misperrors['error'] = ex.message
if ex.code == 'ForbiddenError':
misperrors['error'] = 'ForbiddenError'
else:
misperrors['error'] = ex.message
return misperrors
return parser.get_result()