mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-09-19 03:29:48 -04:00
Handle JSON decoding errors in _get_data function
This commit is contained in:
1 parent
d49abd9d02
commit
aba1ddd3df
1 file changed
+4
-1
@@ -58,7 +58,10 @@ def _get_data(api_token, node_url):
|
||||
try:
|
||||
response = requests.get(node_url + API_ENDPOINT, headers=headers, timeout=5)
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
try:
|
||||
return response.json()
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
except requests.RequestException:
|
||||
pass
|
||||
return ""
|
||||
|
||||
Reference in new issue
Block a user