aerodatabox: add browser User-Agent, fixes 403 from Cloudflare/RapidAPI gateway

This commit is contained in:
2026-09-15 22:22:33 +10:00
parent d524e6d343
commit 5d2a7cde77
3 changed files with 60 additions and 2 deletions
+7 -1
View File
@@ -19,10 +19,16 @@ AIRTRAIL_API_KEY = os.environ.get("AIRTRAIL_API_KEY", "")
# manual Search to fill in, same as today.
AERODATABOX_API_KEY = os.environ.get("AERODATABOX_API_KEY", "")
FLIGHTAWARE_USER_AGENT = (
# Shared browser UA for every outbound scrape/API call this pipeline makes.
# Both FlightAware and (as of the AeroDataBox 403 debugging session) the
# AeroDataBox/RapidAPI gateway sit behind Cloudflare and reject requests
# carrying Python urllib's default User-Agent - confirmed live: the exact
# same request/key/URL got HTTP 403 with no UA and HTTP 200 with this one.
BROWSER_USER_AGENT = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/124.0 Safari/537.36"
)
FLIGHTAWARE_USER_AGENT = BROWSER_USER_AGENT # kept for anything still importing the old name
MAX_TRACK_POINTS = 2000
MAX_FETCH_ATTEMPTS = 5