FlightRadarAPI 1.3.25__tar.gz → 1.3.27__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.
@@ -5,3 +5,5 @@ dist
5
5
  .idea/
6
6
  venv/
7
7
  node_modules/
8
+ .env
9
+ .cache
@@ -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.25"
16
+ __version__ = "1.3.27"
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={}"
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.3
2
+ Name: FlightRadarAPI
3
+ Version: 1.3.27
4
+ Summary: SDK for FlightRadar24
5
+ Project-URL: Homepage, https://github.com/JeanExtreme002/FlightRadarAPI
6
+ Author-email: Jean Loui Bernard Silva de Jesus <jeanextreme002@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: aircraft,airlines,airports,api,aviation,flightradar24,flights,radar
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Requires-Python: >=3.7
18
+ Requires-Dist: brotli
19
+ Requires-Dist: requests
20
+ Provides-Extra: tests
21
+ Requires-Dist: pytest; extra == 'tests'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # FlightRadarAPI
25
+ Unofficial SDK for [FlightRadar24](https://www.flightradar24.com/) for Python 3 and NodeJS.
26
+
27
+ If you want to use the data collected using this SDK commercially, you need to subscribe to the [Business plan](https://www.flightradar24.com/premium/).</br>
28
+ See more information at: https://www.flightradar24.com/terms-and-conditions
29
+
30
+ [![Python Package](https://github.com/JeanExtreme002/FlightRadarAPI/workflows/Python%20Package/badge.svg)](https://github.com/JeanExtreme002/FlightRadarAPI/actions)
31
+ [![Pypi](https://img.shields.io/pypi/v/FlightRadarAPI?logo=pypi)](https://pypi.org/project/FlightRadarAPI/)
32
+ [![License](https://img.shields.io/pypi/l/FlightRadarAPI)](https://github.com/JeanExtreme002/FlightRadarAPI)
33
+ [![Python Version](https://img.shields.io/badge/python-3.7+-8A2BE2)](https://pypi.org/project/FlightRadarAPI/)
34
+ [![Npm](https://img.shields.io/npm/v/flightradarapi?logo=npm&color=red)](https://www.npmjs.com/package/flightradarapi)
35
+ [![Downloads](https://static.pepy.tech/personalized-badge/flightradarapi?period=total&units=international_system&left_color=grey&right_color=orange&left_text=downloads)](https://pypi.org/project/FlightRadarAPI/)
36
+ [![Frequency](https://img.shields.io/pypi/dm/flightradarapi?style=flat&label=frequency)](https://pypi.org/project/FlightRadarAPI/)
37
+ ## Installing FlightRadarAPI
38
+ **For Python with pip:**
39
+ ```
40
+ pip install FlightRadarAPI
41
+ ```
42
+ **For NodeJS with npm:**
43
+ ```
44
+ npm install flightradarapi
45
+ ```
46
+
47
+ ## Documentation
48
+ Explore the documentation of FlightRadarAPI package, for Python or NodeJS, through [this site](https://JeanExtreme002.github.io/FlightRadarAPI/).
@@ -0,0 +1,25 @@
1
+ # FlightRadarAPI
2
+ Unofficial SDK for [FlightRadar24](https://www.flightradar24.com/) for Python 3 and NodeJS.
3
+
4
+ If you want to use the data collected using this SDK commercially, you need to subscribe to the [Business plan](https://www.flightradar24.com/premium/).</br>
5
+ See more information at: https://www.flightradar24.com/terms-and-conditions
6
+
7
+ [![Python Package](https://github.com/JeanExtreme002/FlightRadarAPI/workflows/Python%20Package/badge.svg)](https://github.com/JeanExtreme002/FlightRadarAPI/actions)
8
+ [![Pypi](https://img.shields.io/pypi/v/FlightRadarAPI?logo=pypi)](https://pypi.org/project/FlightRadarAPI/)
9
+ [![License](https://img.shields.io/pypi/l/FlightRadarAPI)](https://github.com/JeanExtreme002/FlightRadarAPI)
10
+ [![Python Version](https://img.shields.io/badge/python-3.7+-8A2BE2)](https://pypi.org/project/FlightRadarAPI/)
11
+ [![Npm](https://img.shields.io/npm/v/flightradarapi?logo=npm&color=red)](https://www.npmjs.com/package/flightradarapi)
12
+ [![Downloads](https://static.pepy.tech/personalized-badge/flightradarapi?period=total&units=international_system&left_color=grey&right_color=orange&left_text=downloads)](https://pypi.org/project/FlightRadarAPI/)
13
+ [![Frequency](https://img.shields.io/pypi/dm/flightradarapi?style=flat&label=frequency)](https://pypi.org/project/FlightRadarAPI/)
14
+ ## Installing FlightRadarAPI
15
+ **For Python with pip:**
16
+ ```
17
+ pip install FlightRadarAPI
18
+ ```
19
+ **For NodeJS with npm:**
20
+ ```
21
+ npm install flightradarapi
22
+ ```
23
+
24
+ ## Documentation
25
+ Explore the documentation of FlightRadarAPI package, for Python or NodeJS, through [this site](https://JeanExtreme002.github.io/FlightRadarAPI/).
@@ -17,7 +17,7 @@ classifiers = [
17
17
  "Programming Language :: Python :: 3.10",
18
18
  "Programming Language :: Python :: 3.11"
19
19
  ]
20
- exclude = ["tests"]
20
+ exclude = ["tests", ".flake8"]
21
21
  requires-python = ">=3.7"
22
22
  dependencies = [
23
23
  "Brotli",
@@ -1,142 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: FlightRadarAPI
3
- Version: 1.3.25
4
- Summary: SDK for FlightRadar24
5
- Project-URL: Homepage, https://github.com/JeanExtreme002/FlightRadarAPI
6
- Author-email: Jean Loui Bernard Silva de Jesus <jeanextreme002@gmail.com>
7
- License-Expression: MIT
8
- License-File: LICENSE
9
- Keywords: aircraft,airlines,airports,api,aviation,flightradar24,flights,radar
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3 :: Only
12
- Classifier: Programming Language :: Python :: 3.7
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Requires-Python: >=3.7
18
- Requires-Dist: brotli
19
- Requires-Dist: requests
20
- Provides-Extra: tests
21
- Requires-Dist: pytest; extra == 'tests'
22
- Description-Content-Type: text/markdown
23
-
24
- # FlightRadarAPI
25
- Unofficial SDK for [FlightRadar24](https://www.flightradar24.com/) written in Python 3.
26
-
27
- If you want to use the data collected using this SDK commercially, you need to subscribe to the [Business plan](https://www.flightradar24.com/premium/).</br>
28
- See more information at: https://www.flightradar24.com/terms-and-conditions
29
-
30
- [![Python Package](https://github.com/JeanExtreme002/FlightRadarAPI/workflows/Python%20Package/badge.svg)](https://github.com/JeanExtreme002/FlightRadarAPI/actions)
31
- [![Pypi](https://img.shields.io/pypi/v/FlightRadarAPI?logo=pypi)](https://pypi.org/project/FlightRadarAPI/)
32
- [![License](https://img.shields.io/pypi/l/FlightRadarAPI)](https://github.com/JeanExtreme002/FlightRadarAPI)
33
- [![Python Version](https://img.shields.io/badge/python-3.7+-8A2BE2)](https://pypi.org/project/FlightRadarAPI/)
34
- [![Npm](https://img.shields.io/npm/v/flightradarapi?logo=npm&color=red)](https://www.npmjs.com/package/flightradarapi)
35
- [![Downloads](https://static.pepy.tech/personalized-badge/flightradarapi?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pypi.org/project/FlightRadarAPI/)
36
-
37
- ## Installing FlightRadarAPI:
38
- ```
39
- pip install FlightRadarAPI
40
- ```
41
-
42
- ## Basic Usage:
43
- Import the class `FlightRadar24API` and create an instance of it.
44
- ```py
45
- from FlightRadar24 import FlightRadar24API
46
- fr_api = FlightRadar24API()
47
- ```
48
-
49
- **Getting flights list:**
50
- ```py
51
- flights = fr_api.get_flights(...) # Returns a list of Flight objects
52
- ```
53
-
54
- **Getting airports list:**
55
- ```py
56
- airports = fr_api.get_airports(...) # Returns a list of Airport objects
57
- ```
58
-
59
- **Getting airlines list:**
60
- ```py
61
- airlines = fr_api.get_airlines()
62
- ```
63
-
64
- **Getting zones list:**
65
- ```py
66
- zones = fr_api.get_zones()
67
- ```
68
-
69
- ### Getting flight and airport details
70
- You can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.
71
- ```py
72
- flight_details = fr_api.get_flight_details(flight)
73
- flight.set_flight_details(flight_details)
74
-
75
- print("Flying to", flight.destination_airport_name)
76
- ```
77
-
78
- Or get more information about a specific airport such as: runways, weather, arrived flights, etc.
79
- ```py
80
- airport_details = fr_api.get_airport_details(icao)
81
- ```
82
- Arrivals and departures can have a limit `flight_limit` (max value is 100) to display. When you need to reach more than 100 flights you can use additional parameter `page` to view other pages.
83
-
84
-
85
- ## Get flights above your position:
86
- The `get_bounds_by_point(...)` method has parameters `latitude` and `longitude` for your position and `radius` for the distance in meters from your position to designate a tracking area.
87
- ```py
88
- # Your point is 52°34'04.7"N 13°16'57.5"E from Google Maps and radius 2km
89
- bounds = fr_api.get_bounds_by_point(52.567967, 13.282644, 2000)
90
-
91
- flights = fr_api.get_flights(bounds = bounds)
92
- ```
93
-
94
- ## Filtering flights and airports:
95
- The `get_flights(...)` method has some parameters to search for flights by: area line, bounds (customized coordinates
96
- or obtained by the `get_zones()` method), aircraft registration or aircraft type. See the example below:
97
- ```py
98
- airline_icao = "UAE"
99
- aircraft_type = "B77W"
100
-
101
- # You may also set a custom region, such as: bounds = "73,-12,-156,38"
102
- zone = fr_api.get_zones()["northamerica"]
103
- bounds = fr_api.get_bounds(zone)
104
-
105
- emirates_flights = fr_api.get_flights(
106
- aircraft_type = aircraft_type
107
- airline = airline_icao,
108
- bounds = bounds
109
- )
110
- ```
111
- There are more configurations that you may set by using the `set_flight_tracker_config(...)` method. See the method documentation
112
- for more information.
113
-
114
- **Getting airport by ICAO or IATA:**
115
- ```py
116
- lukla_airport = fr_api.get_airport(code = "VNLK", details = True)
117
- ```
118
-
119
- ## Getting the distance between flights and airports:
120
- The `Flight` and `Airport` classes inherit from `Entity`, which contains the `get_distance_from(...)` method. That method
121
- returns the distance between the self instance and another entity in kilometers. Example:
122
- ```py
123
- airport = fr_api.get_airport("KJFK")
124
- distance = flight.get_distance_from(airport)
125
-
126
- print(f"The flight is {distance} km away from the airport.")
127
- ```
128
-
129
- ## Setting and getting Real-time Flight Tracker parameters:
130
- Set it by using the `set_flight_tracker_config(...)` method. It receives a `FlightTrackerConfig` dataclass instance, but
131
- you can also use keyword arguments directly to the method.
132
-
133
- Get the current configuration with the `get_flight_tracker_config()` method, that returns a `FlightTrackerConfig`
134
- instance. Note: creating a new `FlightTrackerConfig` instance means resetting all parameters to default.
135
- ```py
136
- flight_tracker = fr_api.get_flight_tracker_config()
137
- flight_tracker.limit = 10
138
-
139
- fr_api.set_flight_tracker_config(flight_tracker, ...)
140
-
141
- flights = fr_api.get_flights(...) # Returns only 10 flights
142
- ```
@@ -1,119 +0,0 @@
1
- # FlightRadarAPI
2
- Unofficial SDK for [FlightRadar24](https://www.flightradar24.com/) written in Python 3.
3
-
4
- If you want to use the data collected using this SDK commercially, you need to subscribe to the [Business plan](https://www.flightradar24.com/premium/).</br>
5
- See more information at: https://www.flightradar24.com/terms-and-conditions
6
-
7
- [![Python Package](https://github.com/JeanExtreme002/FlightRadarAPI/workflows/Python%20Package/badge.svg)](https://github.com/JeanExtreme002/FlightRadarAPI/actions)
8
- [![Pypi](https://img.shields.io/pypi/v/FlightRadarAPI?logo=pypi)](https://pypi.org/project/FlightRadarAPI/)
9
- [![License](https://img.shields.io/pypi/l/FlightRadarAPI)](https://github.com/JeanExtreme002/FlightRadarAPI)
10
- [![Python Version](https://img.shields.io/badge/python-3.7+-8A2BE2)](https://pypi.org/project/FlightRadarAPI/)
11
- [![Npm](https://img.shields.io/npm/v/flightradarapi?logo=npm&color=red)](https://www.npmjs.com/package/flightradarapi)
12
- [![Downloads](https://static.pepy.tech/personalized-badge/flightradarapi?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pypi.org/project/FlightRadarAPI/)
13
-
14
- ## Installing FlightRadarAPI:
15
- ```
16
- pip install FlightRadarAPI
17
- ```
18
-
19
- ## Basic Usage:
20
- Import the class `FlightRadar24API` and create an instance of it.
21
- ```py
22
- from FlightRadar24 import FlightRadar24API
23
- fr_api = FlightRadar24API()
24
- ```
25
-
26
- **Getting flights list:**
27
- ```py
28
- flights = fr_api.get_flights(...) # Returns a list of Flight objects
29
- ```
30
-
31
- **Getting airports list:**
32
- ```py
33
- airports = fr_api.get_airports(...) # Returns a list of Airport objects
34
- ```
35
-
36
- **Getting airlines list:**
37
- ```py
38
- airlines = fr_api.get_airlines()
39
- ```
40
-
41
- **Getting zones list:**
42
- ```py
43
- zones = fr_api.get_zones()
44
- ```
45
-
46
- ### Getting flight and airport details
47
- You can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.
48
- ```py
49
- flight_details = fr_api.get_flight_details(flight)
50
- flight.set_flight_details(flight_details)
51
-
52
- print("Flying to", flight.destination_airport_name)
53
- ```
54
-
55
- Or get more information about a specific airport such as: runways, weather, arrived flights, etc.
56
- ```py
57
- airport_details = fr_api.get_airport_details(icao)
58
- ```
59
- Arrivals and departures can have a limit `flight_limit` (max value is 100) to display. When you need to reach more than 100 flights you can use additional parameter `page` to view other pages.
60
-
61
-
62
- ## Get flights above your position:
63
- The `get_bounds_by_point(...)` method has parameters `latitude` and `longitude` for your position and `radius` for the distance in meters from your position to designate a tracking area.
64
- ```py
65
- # Your point is 52°34'04.7"N 13°16'57.5"E from Google Maps and radius 2km
66
- bounds = fr_api.get_bounds_by_point(52.567967, 13.282644, 2000)
67
-
68
- flights = fr_api.get_flights(bounds = bounds)
69
- ```
70
-
71
- ## Filtering flights and airports:
72
- The `get_flights(...)` method has some parameters to search for flights by: area line, bounds (customized coordinates
73
- or obtained by the `get_zones()` method), aircraft registration or aircraft type. See the example below:
74
- ```py
75
- airline_icao = "UAE"
76
- aircraft_type = "B77W"
77
-
78
- # You may also set a custom region, such as: bounds = "73,-12,-156,38"
79
- zone = fr_api.get_zones()["northamerica"]
80
- bounds = fr_api.get_bounds(zone)
81
-
82
- emirates_flights = fr_api.get_flights(
83
- aircraft_type = aircraft_type
84
- airline = airline_icao,
85
- bounds = bounds
86
- )
87
- ```
88
- There are more configurations that you may set by using the `set_flight_tracker_config(...)` method. See the method documentation
89
- for more information.
90
-
91
- **Getting airport by ICAO or IATA:**
92
- ```py
93
- lukla_airport = fr_api.get_airport(code = "VNLK", details = True)
94
- ```
95
-
96
- ## Getting the distance between flights and airports:
97
- The `Flight` and `Airport` classes inherit from `Entity`, which contains the `get_distance_from(...)` method. That method
98
- returns the distance between the self instance and another entity in kilometers. Example:
99
- ```py
100
- airport = fr_api.get_airport("KJFK")
101
- distance = flight.get_distance_from(airport)
102
-
103
- print(f"The flight is {distance} km away from the airport.")
104
- ```
105
-
106
- ## Setting and getting Real-time Flight Tracker parameters:
107
- Set it by using the `set_flight_tracker_config(...)` method. It receives a `FlightTrackerConfig` dataclass instance, but
108
- you can also use keyword arguments directly to the method.
109
-
110
- Get the current configuration with the `get_flight_tracker_config()` method, that returns a `FlightTrackerConfig`
111
- instance. Note: creating a new `FlightTrackerConfig` instance means resetting all parameters to default.
112
- ```py
113
- flight_tracker = fr_api.get_flight_tracker_config()
114
- flight_tracker.limit = 10
115
-
116
- fr_api.set_flight_tracker_config(flight_tracker, ...)
117
-
118
- flights = fr_api.get_flights(...) # Returns only 10 flights
119
- ```
File without changes
File without changes