|
1 | 1 | # SPDX-FileCopyrightText: 2024 DJDevon3
|
2 | 2 | # SPDX-License-Identifier: MIT
|
3 |
| -# Coded for Circuit Python 8.2.x |
4 |
| -"""OpenSky-Network.org Public API Example""" |
5 |
| -# pylint: disable=import-error |
| 3 | +# Coded for Circuit Python 9.x |
| 4 | +"""OpenSky-Network.org Single Flight Public API Example""" |
6 | 5 |
|
7 | 6 | import os
|
8 | 7 | import time
|
|
17 | 16 | # All active flights JSON: https://opensky-network.org/api/states/all PICK ONE!
|
18 | 17 | # JSON order: transponder, callsign, country
|
19 | 18 | # ACTIVE transpondes only, for multiple "c822af&icao24=cb3993&icao24=c63923"
|
20 |
| -TRANSPONDER = "3c5ef8" |
| 19 | +TRANSPONDER = "88044d" |
21 | 20 |
|
22 | 21 | # Get WiFi details, ensure these are setup in settings.toml
|
23 | 22 | ssid = os.getenv("CIRCUITPY_WIFI_SSID")
|
24 | 23 | password = os.getenv("CIRCUITPY_WIFI_PASSWORD")
|
25 |
| -osnusername = os.getenv("OSN_USERNAME") # Website Credentials |
26 |
| -osnpassword = os.getenv("OSN_PASSWORD") # Website Credentials |
27 | 24 |
|
28 | 25 | # API Polling Rate
|
29 | 26 | # 900 = 15 mins, 1800 = 30 mins, 3600 = 1 hour
|
@@ -80,15 +77,16 @@ def _format_datetime(datetime):
|
80 | 77 | print("✅ Wifi!")
|
81 | 78 |
|
82 | 79 | try:
|
83 |
| - print(" | Attempting to GET OpenSky-Network Single Flight JSON!") |
| 80 | + print(" | Attempting to GET OpenSky-Network Single Public Flight JSON!") |
| 81 | + print(" | Website Credentials NOT Required! Less daily calls than Private.") |
84 | 82 | try:
|
85 | 83 | opensky_response = requests.get(url=OPENSKY_SOURCE)
|
86 | 84 | opensky_json = opensky_response.json()
|
87 | 85 | except ConnectionError as e:
|
88 | 86 | print("Connection Error:", e)
|
89 | 87 | print("Retrying in 10 seconds")
|
90 | 88 |
|
91 |
| - print(" | ✅ OpenSky-Network JSON!") |
| 89 | + print(" | ✅ OpenSky-Network Public JSON!") |
92 | 90 |
|
93 | 91 | if DEBUG:
|
94 | 92 | print("Full API GET URL: ", OPENSKY_SOURCE)
|
|
0 commit comments