FlightRadarAPI 1.5.1__tar.gz → 1.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/.gitignore +5 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/__init__.py +1 -1
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/api.py +28 -14
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/request.py +11 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/PKG-INFO +2 -2
- flightradarapi-1.5.1/.tool-versions +0 -1
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadar24/__init__.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/core.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/entities/__init__.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/entities/airport.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/entities/entity.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/entities/flight.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/errors.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/flight_tracker_config.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/parsers.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/py.typed +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/FlightRadarAPI/zones.py +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/LICENSE +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/Makefile +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/README.md +0 -0
- {flightradarapi-1.5.1 → flightradarapi-1.5.2}/pyproject.toml +0 -0
|
@@ -14,6 +14,13 @@ from .flight_tracker_config import FlightTrackerConfig
|
|
|
14
14
|
from .parsers import parse_airlines_html, parse_airports_html
|
|
15
15
|
from .request import APIClient, RetryPolicy
|
|
16
16
|
|
|
17
|
+
# Some FR24 live-feed backends answer 200 with a well-formed envelope but no
|
|
18
|
+
# flight entries -- indistinguishable from a legitimately empty result. The
|
|
19
|
+
# "AWSALB" cookie then pins the session to that backend, so dropping it is what
|
|
20
|
+
# makes the load balancer re-roll on retry.
|
|
21
|
+
FEED_STICKY_COOKIES = ("AWSALB", "AWSALBCORS")
|
|
22
|
+
FEED_EMPTY_RETRIES = 4
|
|
23
|
+
|
|
17
24
|
|
|
18
25
|
class FlightRadar24API:
|
|
19
26
|
"""
|
|
@@ -342,24 +349,31 @@ class FlightRadar24API:
|
|
|
342
349
|
if registration is not None: request_params["reg"] = registration
|
|
343
350
|
if aircraft_type is not None: request_params["type"] = aircraft_type
|
|
344
351
|
|
|
345
|
-
# Get all flights from Data Live FlightRadar24.
|
|
346
|
-
response = self.__client.request(
|
|
347
|
-
Core.real_time_flight_tracker_data_url,
|
|
348
|
-
params=request_params,
|
|
349
|
-
headers=Core.json_headers,
|
|
350
|
-
timeout=self.timeout,
|
|
351
|
-
)
|
|
352
|
-
content = response.get_json_content()
|
|
353
|
-
|
|
354
352
|
flights: List[Flight] = list()
|
|
355
353
|
|
|
356
|
-
for
|
|
354
|
+
for _ in range(FEED_EMPTY_RETRIES + 1):
|
|
355
|
+
# Get all flights from Data Live FlightRadar24.
|
|
356
|
+
response = self.__client.request(
|
|
357
|
+
Core.real_time_flight_tracker_data_url,
|
|
358
|
+
params=request_params,
|
|
359
|
+
headers=Core.json_headers,
|
|
360
|
+
timeout=self.timeout,
|
|
361
|
+
)
|
|
362
|
+
content = response.get_json_content()
|
|
357
363
|
|
|
358
364
|
# Get flights only.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
365
|
+
flights = [
|
|
366
|
+
Flight(flight_id, flight_info)
|
|
367
|
+
for flight_id, flight_info in content.items()
|
|
368
|
+
if flight_id[0].isnumeric()
|
|
369
|
+
]
|
|
370
|
+
|
|
371
|
+
# "full_count": 0 means the feed really has nothing to report.
|
|
372
|
+
if flights or not content.get("full_count"):
|
|
373
|
+
break
|
|
374
|
+
|
|
375
|
+
for cookie_name in FEED_STICKY_COOKIES:
|
|
376
|
+
self.__client.delete_cookie(cookie_name)
|
|
363
377
|
|
|
364
378
|
if details:
|
|
365
379
|
with ThreadPoolExecutor(max_workers=self.max_workers) as executor:
|
|
@@ -122,6 +122,17 @@ class APIClient:
|
|
|
122
122
|
"""Clear all cookies from the session."""
|
|
123
123
|
self.__session.cookies.clear()
|
|
124
124
|
|
|
125
|
+
def delete_cookie(self, name: str) -> None:
|
|
126
|
+
"""Drop a single cookie, leaving the rest of the jar intact.
|
|
127
|
+
|
|
128
|
+
Sheds load-balancer stickiness without discarding the login session,
|
|
129
|
+
which lives in the same jar.
|
|
130
|
+
"""
|
|
131
|
+
try:
|
|
132
|
+
del self.__session.cookies[name]
|
|
133
|
+
except KeyError:
|
|
134
|
+
pass
|
|
135
|
+
|
|
125
136
|
|
|
126
137
|
class APIRequest:
|
|
127
138
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: FlightRadarAPI
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.2
|
|
4
4
|
Summary: SDK for FlightRadar24
|
|
5
5
|
Project-URL: Homepage, https://github.com/JeanExtreme002/FlightRadarAPI
|
|
6
6
|
Project-URL: Source Code, https://github.com/JeanExtreme002/FlightRadarAPI
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
python 3.11.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|