Mirror of https://github.com/Jxck-S/plane-notify
This is the backend to ElonsJet and other bots
acasads-badsbadsbexchangeadsbxairportemergency-squawklandopenskyopensky-apiopensky-networkplaneresolutionadviosrysquawktakeofftcas
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
769 B
17 lines
769 B
def pullOpenSky(planes): |
|
import configparser |
|
main_config = configparser.ConfigParser() |
|
main_config.read('./configs/mainconf.ini') |
|
from opensky_api import OpenSkyApi |
|
planeData = None |
|
opens_api = OpenSkyApi(username= None if main_config.get('OPENSKY', 'USERNAME').upper() == "NONE" else main_config.get('OPENSKY', 'USERNAME'), password= None if main_config.get('OPENSKY', 'PASSWORD').upper() == "NONE" else main_config.get('OPENSKY', 'PASSWORD').upper()) |
|
failed = False |
|
icao_array = [] |
|
for key in planes.keys(): |
|
icao_array.append(key.lower()) |
|
try: |
|
planeData = opens_api.get_states(time_secs=0, icao24=icao_array) |
|
except: |
|
print ("OpenSky Error") |
|
failed = True |
|
return planeData, failed |