From a904f7fd2ad92965d26600a1f09c3950ebfe3178 Mon Sep 17 00:00:00 2001 From: krakenrf <78108016+krakenrf@users.noreply.github.com> Date: Sun, 23 Oct 2022 17:06:31 +1300 Subject: Create dump1090_krakenmap.py --- misc_scripts/dump1090_krakenmap.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 misc_scripts/dump1090_krakenmap.py diff --git a/misc_scripts/dump1090_krakenmap.py b/misc_scripts/dump1090_krakenmap.py new file mode 100644 index 0000000..e34962d --- /dev/null +++ b/misc_scripts/dump1090_krakenmap.py @@ -0,0 +1,35 @@ +import requests +import json +import time + +# The unique ICAO ID of the aircraft in HEX. Ensure it is LOWERCASE. +HEX_ID = "c822ed" + +API_SERVER = 'https://map.krakenrf.com:443' + +# Your Kraken Pro Cloud username and password +login = {'username': 'username', 'password': 'password'} + +x = requests.post(API_SERVER + '/login', json = login) +token = x.text + +print(x.text) + +while True: + f = open('aircraft.json') + data = json.load(f) + + for aircraft in data['aircraft']: +# print(aircraft['hex']) + if aircraft['hex'] == HEX_ID: + try: + beaconData = {'lat': aircraft['lat'], 'lon': aircraft['lon'], 'speed': aircraft['gs'], 'height': aircraft['alt_geom']} + x = requests.post(API_SERVER + '/beacon', json = beaconData, headers = {'Authorization': token}) + + print (aircraft['lat']) + print (aircraft['lon']) + except: + print('EXCEPTION: Probably out of range') + pass # + + time.sleep(1) -- cgit v1.2.3