Skip to content

Commit 12e6b47

Browse files
authored
Merge pull request #172 from DJDevon3/DJDevon3-openskynetwork_public
Update OpenSky-Network Public Single Flight API Example
2 parents 0c193c6 + 019f126 commit 12e6b47

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

examples/wifi/expanded/requests_wifi_api_openskynetwork_private.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-FileCopyrightText: 2024 DJDevon3
22
# SPDX-License-Identifier: MIT
3-
# Coded for Circuit Python 8.2.x
3+
# Coded for Circuit Python 9.x
44
"""OpenSky-Network.org Single Flight Private API Example"""
55

66
import binascii

examples/wifi/expanded/requests_wifi_api_openskynetwork_public.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# SPDX-FileCopyrightText: 2024 DJDevon3
22
# 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"""
65

76
import os
87
import time
@@ -17,13 +16,11 @@
1716
# All active flights JSON: https://opensky-network.org/api/states/all PICK ONE!
1817
# JSON order: transponder, callsign, country
1918
# ACTIVE transpondes only, for multiple "c822af&icao24=cb3993&icao24=c63923"
20-
TRANSPONDER = "3c5ef8"
19+
TRANSPONDER = "88044d"
2120

2221
# Get WiFi details, ensure these are setup in settings.toml
2322
ssid = os.getenv("CIRCUITPY_WIFI_SSID")
2423
password = os.getenv("CIRCUITPY_WIFI_PASSWORD")
25-
osnusername = os.getenv("OSN_USERNAME") # Website Credentials
26-
osnpassword = os.getenv("OSN_PASSWORD") # Website Credentials
2724

2825
# API Polling Rate
2926
# 900 = 15 mins, 1800 = 30 mins, 3600 = 1 hour
@@ -80,15 +77,16 @@ def _format_datetime(datetime):
8077
print("✅ Wifi!")
8178

8279
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.")
8482
try:
8583
opensky_response = requests.get(url=OPENSKY_SOURCE)
8684
opensky_json = opensky_response.json()
8785
except ConnectionError as e:
8886
print("Connection Error:", e)
8987
print("Retrying in 10 seconds")
9088

91-
print(" | ✅ OpenSky-Network JSON!")
89+
print(" | ✅ OpenSky-Network Public JSON!")
9290

9391
if DEBUG:
9492
print("Full API GET URL: ", OPENSKY_SOURCE)

0 commit comments

Comments
 (0)