Browse Source

Fix error message not defined

pull/2/head
Jxck-S 4 years ago
parent
commit
d8d6df7b33
  1. 4
      defADSBX.py

4
defADSBX.py

@ -21,7 +21,7 @@ def pullADSBX(planes):
try:
response = requests.get(url, headers = headers)
response.raise_for_status()
except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError, requests.exceptions.Timeout, requests.exceptions.RequestException):
except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError, requests.exceptions.Timeout, requests.exceptions.RequestException) as error_message:
print("Basic Connection Error")
print(error_message)
failed = True
@ -37,7 +37,7 @@ def pullADSBX(planes):
failed = True
data = None
else:
if response.status_code == 200:
if "response" in locals() and response.status_code == 200:
try:
data = json.loads(response.text)
except (json.decoder.JSONDecodeError, ValueError) as error_message:

Loading…
Cancel
Save