FlightRadarAPI 1.3.25__tar.gz → 1.3.26__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.3.25 → flightradarapi-1.3.26}/.gitignore +1 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/__init__.py +1 -1
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/api.py +24 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/core.py +3 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/PKG-INFO +18 -3
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/README.md +16 -1
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/pyproject.toml +1 -1
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/.flake8 +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/entities/__init__.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/entities/airport.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/entities/entity.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/entities/flight.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/errors.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/FlightRadar24/request.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/LICENSE +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/requirements.txt +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/tests/package.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/tests/test_api.py +0 -0
- {flightradarapi-1.3.25 → flightradarapi-1.3.26}/tests/util.py +0 -0
|
@@ -13,7 +13,7 @@ https://www.flightradar24.com/terms-and-conditions
|
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
__author__ = "Jean Loui Bernard Silva de Jesus"
|
|
16
|
-
__version__ = "1.3.
|
|
16
|
+
__version__ = "1.3.26"
|
|
17
17
|
|
|
18
18
|
from .api import FlightRadar24API, FlightTrackerConfig
|
|
19
19
|
from .entities import Airport, Entity, Flight
|
|
@@ -333,6 +333,30 @@ class FlightRadar24API(object):
|
|
|
333
333
|
"""
|
|
334
334
|
return dataclasses.replace(self.__flight_tracker_config)
|
|
335
335
|
|
|
336
|
+
def get_history_data(self, flight: Flight, file_type: str, timestamp: int) -> Dict:
|
|
337
|
+
"""
|
|
338
|
+
Download historical data of a flight.
|
|
339
|
+
|
|
340
|
+
:param flight: A Flight instance
|
|
341
|
+
:param file_type: Must be "CSV" or "KML"
|
|
342
|
+
:param timestamp: A Unix timestamp
|
|
343
|
+
"""
|
|
344
|
+
if not self.is_logged_in():
|
|
345
|
+
raise LoginError("You must log in to your account.")
|
|
346
|
+
|
|
347
|
+
file_type = file_type.lower()
|
|
348
|
+
|
|
349
|
+
if file_type not in ["csv", "kml"]:
|
|
350
|
+
raise ValueError(f"File type '{file_type}' is not supported. Only CSV and KML are supported.")
|
|
351
|
+
|
|
352
|
+
response = APIRequest(
|
|
353
|
+
Core.historical_data_url.format(flight.id, file_type, timestamp),
|
|
354
|
+
headers=Core.json_headers, cookies=self.__login_data["cookies"],
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
content = response.get_content()
|
|
358
|
+
return str(content.decode("utf-8"))
|
|
359
|
+
|
|
336
360
|
def get_login_data(self) -> Dict[Any, Any]:
|
|
337
361
|
"""
|
|
338
362
|
Return the user data.
|
|
@@ -23,6 +23,9 @@ class Core(ABC):
|
|
|
23
23
|
real_time_flight_tracker_data_url = data_cloud_base_url + "/zones/fcgi/feed.js"
|
|
24
24
|
flight_data_url = data_live_base_url + "/clickhandler/?flight={}"
|
|
25
25
|
|
|
26
|
+
# Historical data URL.
|
|
27
|
+
historical_data_url = flightradar_base_url + "/download/?flight={}&file={}&trailLimit=0&history={}"
|
|
28
|
+
|
|
26
29
|
# Airports data URLs.
|
|
27
30
|
api_airport_data_url = api_flightradar_base_url + "/airport.json"
|
|
28
31
|
airport_data_url = flightradar_base_url + "/airports/traffic-stats/?airport={}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: FlightRadarAPI
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.26
|
|
4
4
|
Summary: SDK for FlightRadar24
|
|
5
5
|
Project-URL: Homepage, https://github.com/JeanExtreme002/FlightRadarAPI
|
|
6
6
|
Author-email: Jean Loui Bernard Silva de Jesus <jeanextreme002@gmail.com>
|
|
@@ -32,7 +32,8 @@ See more information at: https://www.flightradar24.com/terms-and-conditions
|
|
|
32
32
|
[](https://github.com/JeanExtreme002/FlightRadarAPI)
|
|
33
33
|
[](https://pypi.org/project/FlightRadarAPI/)
|
|
34
34
|
[](https://www.npmjs.com/package/flightradarapi)
|
|
35
|
-
[](https://pypi.org/project/FlightRadarAPI/)
|
|
36
|
+
[](https://pypi.org/project/FlightRadarAPI/)
|
|
36
37
|
|
|
37
38
|
## Installing FlightRadarAPI:
|
|
38
39
|
```
|
|
@@ -126,6 +127,20 @@ distance = flight.get_distance_from(airport)
|
|
|
126
127
|
print(f"The flight is {distance} km away from the airport.")
|
|
127
128
|
```
|
|
128
129
|
|
|
130
|
+
## Downloading Flight Data
|
|
131
|
+
*Note*: This requires a premium subscription and for you to be logged in.
|
|
132
|
+
|
|
133
|
+
```py
|
|
134
|
+
history_data = fr_api.get_history_data(flight, file_type="csv", time=1706529600)
|
|
135
|
+
|
|
136
|
+
with open("history_data.csv", "w") as file:
|
|
137
|
+
file.write(history_data)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`flight_id` - The ID of the flight. Can be gotten from any other function that returns flight details.
|
|
141
|
+
`file_type` - Either CSV or KML.
|
|
142
|
+
`time` - The STD/scheduled time of deperature in UTC of the flight as a Unix timestamp. Putting an invalid time will return a blank document.
|
|
143
|
+
|
|
129
144
|
## Setting and getting Real-time Flight Tracker parameters:
|
|
130
145
|
Set it by using the `set_flight_tracker_config(...)` method. It receives a `FlightTrackerConfig` dataclass instance, but
|
|
131
146
|
you can also use keyword arguments directly to the method.
|
|
@@ -9,7 +9,8 @@ See more information at: https://www.flightradar24.com/terms-and-conditions
|
|
|
9
9
|
[](https://github.com/JeanExtreme002/FlightRadarAPI)
|
|
10
10
|
[](https://pypi.org/project/FlightRadarAPI/)
|
|
11
11
|
[](https://www.npmjs.com/package/flightradarapi)
|
|
12
|
-
[](https://pypi.org/project/FlightRadarAPI/)
|
|
13
|
+
[](https://pypi.org/project/FlightRadarAPI/)
|
|
13
14
|
|
|
14
15
|
## Installing FlightRadarAPI:
|
|
15
16
|
```
|
|
@@ -103,6 +104,20 @@ distance = flight.get_distance_from(airport)
|
|
|
103
104
|
print(f"The flight is {distance} km away from the airport.")
|
|
104
105
|
```
|
|
105
106
|
|
|
107
|
+
## Downloading Flight Data
|
|
108
|
+
*Note*: This requires a premium subscription and for you to be logged in.
|
|
109
|
+
|
|
110
|
+
```py
|
|
111
|
+
history_data = fr_api.get_history_data(flight, file_type="csv", time=1706529600)
|
|
112
|
+
|
|
113
|
+
with open("history_data.csv", "w") as file:
|
|
114
|
+
file.write(history_data)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`flight_id` - The ID of the flight. Can be gotten from any other function that returns flight details.
|
|
118
|
+
`file_type` - Either CSV or KML.
|
|
119
|
+
`time` - The STD/scheduled time of deperature in UTC of the flight as a Unix timestamp. Putting an invalid time will return a blank document.
|
|
120
|
+
|
|
106
121
|
## Setting and getting Real-time Flight Tracker parameters:
|
|
107
122
|
Set it by using the `set_flight_tracker_config(...)` method. It receives a `FlightTrackerConfig` dataclass instance, but
|
|
108
123
|
you can also use keyword arguments directly to the method.
|
|
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
|