Allows any "msg" from ADSBX to be raised
-Checks msg from ADSBX before looking at ctime -Raises an error when ADSBX msg is not "No Error"
This commit is contained in:
parent
79ff6330d9
commit
b724d99330
12
defADSBX.py
12
defADSBX.py
|
|
@ -57,15 +57,13 @@ def pullADSBX(planes):
|
||||||
if "response" in locals():
|
if "response" in locals():
|
||||||
print ("HTTP Status Code:", response.status_code)
|
print ("HTTP Status Code:", response.status_code)
|
||||||
if failed is False:
|
if failed is False:
|
||||||
data_ctime = float(data['ctime']) / 1000.0
|
|
||||||
print("UTC of Data:",datetime.utcfromtimestamp(data_ctime))
|
|
||||||
print("Current UTC:", datetime.utcnow())
|
|
||||||
try:
|
try:
|
||||||
if data['msg'] == 'You need a key. Get a feeder or use pay API. https://rapidapi.com/adsbx/api/adsbexchange-com1':
|
if data['msg'] != "No error":
|
||||||
print("Bad auth", data['msg'])
|
raise Exception("Error from ADSBX: msg = ", data['msg'])
|
||||||
failed = True
|
failed = True
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
data_ctime = float(data['ctime']) / 1000.0
|
||||||
|
print("UTC of Data:",datetime.utcfromtimestamp(data_ctime))
|
||||||
|
print("Current UTC:", datetime.utcnow())
|
||||||
return data, failed
|
return data, failed
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue