mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-31 07:12:23 -07:00
Handle JSON decoding errors in _get_data function
This commit is contained in:
@@ -58,7 +58,10 @@ def _get_data(api_token, node_url):
|
|||||||
try:
|
try:
|
||||||
response = requests.get(node_url + API_ENDPOINT, headers=headers, timeout=5)
|
response = requests.get(node_url + API_ENDPOINT, headers=headers, timeout=5)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return response.json()
|
try:
|
||||||
|
return response.json()
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
pass
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
pass
|
pass
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user