|
4 | 4 | """OpenSky-Network.org Single Flight Private API Example"""
|
5 | 5 | # pylint: disable=import-error
|
6 | 6 |
|
7 |
| -import binascii |
8 | 7 | import os
|
9 | 8 | import time
|
10 | 9 |
|
| 10 | +import binascii |
11 | 11 | import adafruit_connection_manager
|
12 | 12 | import wifi
|
13 | 13 |
|
|
18 | 18 | # All active flights JSON: https://opensky-network.org/api/states/all # PICK ONE! :)
|
19 | 19 | # JSON order: transponder, callsign, country
|
20 | 20 | # ACTIVE transpondes only, for multiple "c822af&icao24=cb3993&icao24=c63923"
|
21 |
| -TRANSPONDER = "4b1806" |
| 21 | +TRANSPONDER = "ad4f1c" |
22 | 22 |
|
23 | 23 | # Get WiFi details, ensure these are setup in settings.toml
|
24 | 24 | ssid = os.getenv("CIRCUITPY_WIFI_SSID")
|
|
46 | 46 | # base64 encode and strip appended \n from bytearray
|
47 | 47 | OSN_CREDENTIALS_B = binascii.b2a_base64(b"" + str(OSN_CREDENTIALS)).strip()
|
48 | 48 | BASE64_STRING = str(OSN_CREDENTIALS_B) # bytearray
|
49 |
| -TRUNCATED_BASE64_STRING = BASE64_STRING[2:-1] # truncate bytearray head/tail |
| 49 | +SLICED_BASE64_STRING = BASE64_STRING[2:-1] # slice bytearray head/tail |
50 | 50 |
|
51 | 51 | if DEBUG:
|
52 |
| - print("Original Binary Data: ", OSN_CREDENTIALS_B) |
53 | 52 | print("Base64 ByteArray: ", BASE64_STRING)
|
54 |
| - print(f"Base64 String: {TRUNCATED_BASE64_STRING}") |
| 53 | + print(f"Base64 Sliced String: {SLICED_BASE64_STRING}") |
55 | 54 |
|
56 | 55 | # Requests URL - icao24 is their endpoint required for a transponder
|
57 | 56 | # example https://opensky-network.org/api/states/all?icao24=a808c5
|
58 | 57 | # OSN private: requires your website username:password to be base64 encoded
|
59 |
| -OPENSKY_HEADER = {"Authorization": "Basic " + str(TRUNCATED_BASE64_STRING)} |
| 58 | +OPENSKY_HEADER = {"Authorization": "Basic " + str(SLICED_BASE64_STRING)} |
60 | 59 | OPENSKY_SOURCE = "https://opensky-network.org/api/states/all?" + "icao24=" + TRANSPONDER
|
61 | 60 |
|
62 | 61 |
|
|
0 commit comments