jeanextreme002 / flightradarapi Goto Github PK
View Code? Open in Web Editor NEW:airplane: Unofficial SDK for FlightRadar24 for Python 3 and NodeJS
Home Page: https://pypi.org/project/FlightRadarAPI/
License: MIT License
:airplane: Unofficial SDK for FlightRadar24 for Python 3 and NodeJS
Home Page: https://pypi.org/project/FlightRadarAPI/
License: MIT License
Creating a very basic script as below:
from FlightRadar24.api import FlightRadar24API
fr_api = FlightRadar24API()
zones = fr_api.get_zones()
print(zones)
results in a type error:
Traceback (most recent call last):
File "main.py", line 4, in <module>
zones = fr_api.get_zones()
File "/mnt/c/Users/jimbo/Documents/dev/python/flightTracker/basic-env/lib/python3.5/site-packages/FlightRadar24/api.py", line 118, in get_zones
zones = request.get_content()
File "/mnt/c/Users/jimbo/Documents/dev/python/flightTracker/basic-env/lib/python3.5/site-packages/FlightRadar24/request.py", line 46, in get_content
return json.loads(content)
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
I have fixed this by adding a decode at line L46 of request.py
return json.loads(content.decode('utf-8'))
Is this repeatable by others? And would this fix have any knockon effects?
Thanks
If flight id is QR8041 , how to define it in code ?
Is not your feature request related to a problem? Please describe
Additional context
If it is ok - I am ready to do it by myself and then make PR in your project
I am using this api in a python script in a try-except loop... ideally it should run indefinitely in cycles of 15-20 seconds. in each cycle, it is calling this api to get a bunch of flights a given bound. Usually it runs fine, but every now and then, it gives out a connection timeout error. Is anyone else facing the same problem? Also, can this problem be solved by getting a premium account?
This is the error log:
Traceback (most recent call last):
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connection.py", line 198, in _new_conn
sock = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
raise err
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
raise new_e
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connection.py", line 616, in connect
self.sock = sock = self._new_conn()
^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connection.py", line 207, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x000001A3590B6990>, 'Connection to data-cloud.flightradar24.com timed out. (connect timeout=None)')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Proj_Dxxxx\Lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='data-cloud.flightradar24.com', port=443): Max retries exceeded with url: /zones/fcgi/feed.js?faa=1&satellite=1&mlat=1&flarm=1&adsb=1&gnd=1&air=1&vehicles=1&estimated=1&maxage=14400&gliders=1&stats=1&limit=5000&bounds=21.235737033567297%2C16.90672529427908%2C70.61287068113106%2C75.19786605225617 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001A3590B6990>, 'Connection to data-cloud.flightradar24.com timed out. (connect timeout=None)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Proj_Dxxxx\track_missing_flights\track_missing_flights.py", line 194, in
fetch_and_append_ns_flights(fr_api)
^^^^^^
File "D:\Proj_Dxxx\track_missing_flights\track_missing_flights.py", line 190, in main
File "D:\Proj_Dxxx\track_missing_flights\track_missing_flights.py", line 27, in fetch_and_append_ns_flights
flights = fr_api.get_flights(bounds=bounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxx\Lib\site-packages\FlightRadar24\api.py", line 309, in get_flights
response = APIRequest(Core.real_time_flight_tracker_data_url, request_params, Core.json_headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\FlightRadar24\request.py", line 56, in init
self.__response = request_method(url, headers=headers, cookies=cookies, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Proj_Dxxxx\Lib\site-packages\requests\adapters.py", line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='data-cloud.flightradar24.com', port=443): Max retries exceeded with url: /zones/fcgi/feed.js?faa=1&satellite=1&mlat=1&flarm=1&adsb=1&gnd=1&air=1&vehicles=1&estimated=1&maxage=14400&gliders=1&stats=1&limit=5000&bounds=21.235737033567297%2C16.90672529427908%2C70.61287068113106%2C75.19786605225617 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002391081A780>, 'Connection to data-cloud.flightradar24.com timed out. (connect timeout=None)'))
This commit introduced the Deprecated
package and it needs to be added in setup.py
Hey there Jean,
I emailed you about the issue too but I’ll post here as well. So I notice some discrepancies between your data vs Flightradar24. For example between airports A and B there could be 5 flights but your data may only show 4 flights. Another scenario is when there is a flight from A to B the flight shows up in the arrivals info for B but does not show up in departures info for A.
Really nice API. Appreciate all the hard work
Hello
How do you authenticate with your flight radar username and password?
The flight radar api doesnt seem to be sending any data back. it returns an error saying...
File "C:/Users/kaspe/PycharmProjects/acc plotting/main.py", line 207, in Airports
airport = API.get_airports()["rows"]
File "C:\Users\kaspe\PycharmProjects\acc plotting\venv\lib\site-packages\flightradar24\core.py", line 38, in get_airports
return api_request(self.baseUrl + self.metaDataEndPoints['airports'], self.proxies)
File "C:\Users\kaspe\PycharmProjects\acc plotting\venv\lib\site-packages\flightradar24\helpers.py", line 25, in api_request
return r.json()
File "C:\Users\kaspe\PycharmProjects\acc plotting\venv\lib\site-packages\requests\models.py", line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <style>*{box-sizing:border-box;font-family:Open Sans,sans-serif;font-size:10px}body{-webkit-align-items:center;-ms-flex-align:center;align-items:center;background:#385469 no-repeat fixed 50%;background-size:cover;color:#fff;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100vh;overflow-y:hidden;padding:80px 100px}aside:first-child{text-align:center;width:40%}aside:last-child{width:60%}https://github.com/media screen and (max-width:1200px){aside:first-child{display:none}aside:last-child{width:100%}}div.message{background-color:#ededed;border-radius:1.8rem;border:.1rem solid #707070;padding:1.5rem 2.5rem 2.5rem 7.1rem;position:relative}div.message h1{color:#393939;font-size:5rem;margin:0 0 1rem}div.message h1:before{background:#ea5b0c;border-radius:50%;content:" ";display:block;height:2.5rem;left:3rem;position:absolute;top:3.5rem;width:2.5rem}div.message p{color:#6d6d6d;font-size:2.2rem;margin:0}div.twitter{-webkit-align-items:center;-ms-flex-align:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;margin-top:5rem;text-align:center}div.twitter a{color:#83cbf4;text-decoration:underline}div.twitter img{display:block;margin-right:1.7rem}div.twitter *{font-size:2.2rem;font-weight:600}div.cf{border:.1rem solid #ededed;border-radius:1.8rem;margin-top:3rem;padding:2.5rem}div.cf *{font-size:1.2rem;text-shadow:#000 0 0 .2rem}div.cf h1{font-size:1.5rem}</style>
FR24 Canceled
Something went wrong on our end, please try again.
Follow us on Twitter for the latest updates.
Web server is returning an unknown error
There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed.
Ray ID: 6e27c306ea5f76a3
Your IP address: 92.40.170.14
Error reference number: 520
Cloudflare Location: London
I cannot find any documentation on the search endpoint? Could you please provide a couple of examples of different search queries ? Thank you
I'm trying to track a flight, and it works very well when the flight is live. However, is there a way to retrieve the route or other details for a flight that is not currently active?
Is your feature request related to a problem? Please describe.
Get the nearest airport to a location or to a city. Similar to how we can get flights in a given radius of for a given location.
Is not your feature request related to a problem? Please describe
Additional context
It looks like FlightRadar doesn't support an API key
Flightradar24 does not currently offer an API data service, however we aim to release this product towards the end of 2023. For more information about customised live flight data feeds and historic data sets, please contact our Commercial Services team.
https://www.flightradar24.com/premium/
Am I missing something here?
Are there any benefits to making this async? Was thinking of forking and making a separate branch if there was a want/need for asynchronous support.
Hello Jean, how are you? Hope you doing fine.
I’m a fellow brazilian too! Writing in english because more people may have the same question.
Well, first of all congratulations for the API, it’s very good!
I came across your API few days ago and I’m trying to use it, but I have a question, I tried to find your e-mail on github, but I coudn’t.
But, here’s my question: Do you know why “bounds” only return two points? I mean, two pairs os coordinates: latitude and longitude? I mean, in my understanding, bounds of a country, for example, should be at least four points (four pair of coordinates), so that a square area could be drawn, and this would represent a country or a continent. Maybe, these bounds are used in a certain way in aviation that I don’t know about...
I’m interested in planes that only fly above a certain area, and I’m trying do use “bounds” to limit this area. I hope I was clear!
Is there a quota for retrieving flights? I always get an array of max 1500 elements.
This is not a bug, but is is confusing. I ma sure the intention was this to be named
"self.origin_airport_iata = self.__get_info(info[11])"
Thanks for this great module.
It seems country flag should be SVG instead of GIF now. Example: https://www.flightradar24.com/static/images/data/flags-small/germany.svg
Issue
Filter live flights with category
Question
On the https://www.flightradar24.com/ there is a possibility to filter live flights with "categories" (like Cargo). The call is difficult to understand (it's grpc language). Is it possibile to get live flights filtered by category ? (Being connected)
Reproduce
Steps to reproduce the behavior:
Hi,
I'm trying to use your api to get all a380 flights happening now (or today ideally).
I'm doing api.get_flights(aircraft_type = "A388")
It seems it returns the registration number
(as well as altitude, heading, and speed), but no flight number. Any recommended path to get all a380 flight numbers?
Many thanks!
Hello again @JeanExtreme002 , I recently attempted to install the lib again as my laptop decided to obliterate itself so I had to reinstall everything
Unfortunately it seems that pip does not want to play nice with brotli , thus it exits without installing
I have managed to get the May 28 2023 build working tho, pip seems to play nice with it
Please find below a verbose log of the pip install
Thanks - Ivoie
C:\Users\Ivoie>pip3 install FlightRadarAPI -v
Using pip 23.1.2 from C:\Program Files\Python311\Lib\site-packages\pip (python 3.11)
Collecting FlightRadarAPI
Using cached FlightRadarAPI-1.3.7.tar.gz (10 kB)
Running command pip subprocess to install build dependencies
Collecting setuptools>=40.8.0
Using cached setuptools-68.0.0-py3-none-any.whl (804 kB)
Collecting wheel
Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-68.0.0 wheel-0.40.0
Installing build dependencies ... done
Running command Getting requirements to build wheel
Traceback (most recent call last):
File "C:\Program Files\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Program Files\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Local\Temp\pip-build-env-j4v629eb\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Local\Temp\pip-build-env-j4v629eb\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
self.run_setup()
File "C:\Users\Ivoie\AppData\Local\Temp\pip-build-env-j4v629eb\overlay\Lib\site-packages\setuptools\build_meta.py", line 488, in run_setup
self).run_setup(setup_script=setup_script)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Local\Temp\pip-build-env-j4v629eb\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
exec(code, locals())
File "<string>", line 3, in <module>
File "C:\Users\Ivoie\AppData\Local\Temp\pip-install-k2iuhoym\flightradarapi_c3dc49f3968c447b81112f989e7b87e3\FlightRadar24\__init__.py", line 18, in <module>
from .api import FlightRadar24API, FlightTrackerConfig
File "C:\Users\Ivoie\AppData\Local\Temp\pip-install-k2iuhoym\flightradarapi_c3dc49f3968c447b81112f989e7b87e3\FlightRadar24\api.py", line 11, in <module>
from .request import APIRequest
File "C:\Users\Ivoie\AppData\Local\Temp\pip-install-k2iuhoym\flightradarapi_c3dc49f3968c447b81112f989e7b87e3\FlightRadar24\request.py", line 5, in <module>
import brotli
ModuleNotFoundError: No module named 'brotli'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: 'C:\Program Files\Python311\python.exe' 'C:\Program Files\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' get_requires_for_build_wheel 'C:\Users\Ivoie\AppData\Local\Temp\tmp0uvkx1t_'
cwd: C:\Users\Ivoie\AppData\Local\Temp\pip-install-k2iuhoym\flightradarapi_c3dc49f3968c447b81112f989e7b87e3
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Is there more documentation available somewhere, on how to use the API and a list of options?
eg:
`Getting flights by bounds:
bounds = fr_api.get_bounds(zone)
flights = fr_api.get_flights(bounds = bounds)`
this zone variable is not explained, which format or...?
Readme.md of this project suggests that FlightRadar24.com provide API access if one purchases the business plan; however there is no mention of API access on the FlightRadar24.com website at either of the links provided (https://www.flightradar24.com/premium/ or https://www.flightradar24.com/terms-and-conditions). Are you able to share where you got that information?
In a similar vein: Is the underlying API that this library uses officially documented anywhere?
Hi there!
I couldn't find a more appropriate place to put this and I am certain that this is not an "issue" but a failure of my understanding as to how to use the code that you have put together.
Whenever I try calling the example functions that you have included, I get an error message back saying that it is missing one argument of "self." I'm not sure how to get around this as I don't know how the "self" argument would be otherwise initialised.
Apologies for what is likely a very naïve request, but thanks in advance for any help!
Kind regards,
Jon
Hi,
I am currently testing this excellent API and I am trying to retrieve all flights.
Although when running:
flights = fr_api.get_flights()
result = len(flights)
print(result)
It is only returning 1500. Is this customizable or is this a limit of the flightradar API?
Thanks
Describe the bug
The python script unexpectedly stops with this error. I have been using the api for a month, but this error is as recent as 23/04/2024.
File "D:\Pxxx_Dxxx\Lib\site-packages\FlightRadar24\api.py", line 314, in get_flights
for flight_id, flight_info in response.items():
^^^^^^^^^^^^^^
AttributeError: 'bytes' object has no attribute 'items'
System (please complete the following information):
First of all thank you for the library, it is very useful. But I would like to ask why there is a limit of 100 flights when retrieving the departures or arrivals for a given airport. I would therefore suggest the possibility for this number being higher or at least the option (I sincerely do not know whether if it is even posible) to have a kind of offset so that if you cannot retrieve all the information at once you could eventually get it by doing several requests with different offsets (please let me know if I am not explaining myself).
Thank you again and kind regards.
While getting and setting details, I sometime run into this error:
/lib/python3.9/site-packages/FlightRadar24/flight.py", line 88, in set_flight_details aircraft = self.__get_details(flight_details.get("aircraft")) AttributeError: 'bytes' object has no attribute 'get'
I'll do some investigation to see exactly what flight this occurs on.
Executing a
flight.set_flight_details(details)
triggers this exception:
File "....\site-packages\FlightRadar24\flight.py", line 102, in set_flight_details
dest_aiport_code = dest_aiport.get("code", dict())
AttributeError: 'NoneType' object has no attribute 'get'
Looking into flight.py: after
airport = flight_details.get("airport", dict())
a
if airport is not None:
is required and for all the other variables which are set by a flight_details.get() too.
I notice there are only 2 digits behind decimal point of latitude and longitude values in returned data. I traced the requst step of api and found there is no precision loss in data retrieving. Is it the best precision for {free, basic account} usage of FR24? Or I can get more precision with a paid FR24 account? Thank you @JeanExtreme002 and anybody else would like to write a reply.
details = fr_api.get_flight_details(flight_id="B738")
flight.set_flight_details(details)
print("Flying to", flight.destination_airport_name)
for this api call i get an unresolved reference 'flight' how do the flight detail calls work?
Is your problem described in the documentation? If so, please describe
I am quite interested in the latest "history data" feature described here: https://github.com/JeanExtreme002/FlightRadarAPI/tree/main/python#downloading-flight-data
However when pip installing the (obviously Python) library, I see that this functionality is missing in the Api class (checked the source code to confirm), and that the latest version accessible on Pypi is 1.3.25
, despite 1.3.26
being apparently released as per https://github.com/JeanExtreme002/FlightRadarAPI/blob/main/python/FlightRadar24/__init__.py
Describe your question
Considering the recent commits timestamps I was wondering whether it is normal that 1.3.26
is not installable via Pypi yet despite its functionalities being documented ?
Steps to reproduce the behavior:
pip install FlightRadarAPI==1.3.26
Describe the bug
Since a few days the api does not return any results
i’ve upgraded to the Last version with no better luck
does anything changed ?
thanks !
>>> print(fr().get_flight_details("DL200"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\api.py", line 97, in get_flight_details
return request.get_content()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\request.py", line 42, in get_content
return json.loads(content)
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>> print(get_flight_details("DL200"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'get_flight_details' is not defined
>>> print(fr.get_flight_details("DL200"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: FlightRadar24API.get_flight_details() missing 1 required positional argument: 'flight_id'
>>> print(fr.get_flight_details("DL200","DL200"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\api.py", line 97, in get_flight_details
return request.get_content()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\request.py", line 42, in get_content
return json.loads(content)
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>> stor=fr.get_flight_details("DL200","DL200")))
File "<stdin>", line 1
stor=fr.get_flight_details("DL200","DL200")))
^
SyntaxError: unmatched ')'
>>> stor=fr.get_flight_details("DL200","DL200"))
File "<stdin>", line 1
stor=fr.get_flight_details("DL200","DL200"))
^
SyntaxError: unmatched ')'
>>> stor=fr.get_flight_details("DL200","DL200")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\api.py", line 97, in get_flight_details
return request.get_content()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\request.py", line 42, in get_content
return json.loads(content)
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>> stor=str(fr.get_flight_details("DL200","DL200"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\api.py", line 97, in get_flight_details
return request.get_content()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ivoie\AppData\Roaming\Python\Python311\site-packages\FlightRadar24\request.py", line 42, in get_content
return json.loads(content)
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
There is a tempory workround that I have implimented in some of my scripts
for airport in airports:
nyoomzones=nyoomzones+1
a=ast.literal_eval(str(airport))
a=str(a)
#a=a.replace("' ",'" ')
a=a.replace(": '",': "')
a=a.replace("{'",'{"')
a=a.replace("'}",'"}')
a=a.replace("':",'":')
a=a.replace("',",'",')
a=a.replace(", '",', "')
a=a.replace(": '",': "')
a=a.replace("\\xa0","")
# print(a)
b=json.loads(a)
# print(f'\n airport #{nyoomzones} of {len(airports)} {b["name"]} , {b["country"]} , (iata code: {b["iata"]} , icao code: {b["icao"]} ) \n location : " longditude : {b["lon"]} latitude : {b["lat"]} altitude : {b["alt"]} " \n ')
nyoomspot.append(b["name"]) #Airport name
nyoomno.append(nyoomzones) #airport number
nyoomcontroler.append(b["country"]) #Airport country
nyoomiata.append(b["iata"]) #Airport IATA code
nyoomicao.append(b["icao"]) #Airport ICAO code
nyoomlat.append(b["lat"]) #Airport latitude x (left , right)
nyoomlon.append(b["lon"]) #Airport londitude y (forward , back)
nyoomalt.append(b["alt"]) #Airport Altitude z (up down)
^For fetching airports (was correctly implimented)
V For fetching more info on an airport
nyoominfo = fr_api.get_airport(nyoomicao[f])
c=ast.literal_eval(str(nyoominfo))
c=str(c)
#a=a.replace("' ",'" ')
c=c.replace(": '",': "')
c=c.replace("{'",'{"')
c=c.replace("'}",'"}')
c=c.replace("':",'":')
c=c.replace("',",'",')
c=c.replace(", '",', "')
c=c.replace(": '",': "')
c=c.replace("\\xa0","")
c=c.replace("['", '["')
c=c.replace("']", '"]')
c=c.replace("None", '"None"')
c=c.replace("True", 'true')
c=c.replace("False", 'false')
c=c.replace("http://", '')
c=c.replace("https://", '')
print(c)
d=json.loads(c)
#{} {} {} {} {} {} {}
infoName=d['name']
infoCode=d['code']
infoPosition=d['position']
infoTimezone=d['timezone']
infoVisible=d['visible']
infoWebsite=d['website']
infoStats=d['stats']
print(f"name : {infoName} \n\n code : {infoCode} \n\n pos : {infoPosition} \n\n timezone : {infoTimezone} \n\n visib : {infoVisible} \n\n webs : {infoWebsite} \n\n stats : {infoStats} ")
print(f" Details about Airport #{nyoomno[f]}\n=======================================\nName : {nyoomspot[f]} Longditude : {nyoomlon[f]}\nCountry : {nyoomcontroler[f]} Latitude : {nyoomlat[f]}\nA.L.No : {nyoomno[f]} Altitude : {nyoomalt[f]}\nIATA : {nyoomiata[f]} ICAO : {nyoomicao[f]}")
# print(f"Airport information : {nyoominfo} ")
# print(f"METAR REPORT FROM {nyoomspot} ({nyoomicao[f]}): {gd.Metar(nyoomicao[f]).getAttribute('metar')}\nMORE INFO: https://meteocentre.com/doc/metar.html \n DOI : {gd.Metar(nyoomicao[f]).getAttribute('data_date')} \n Changements : {gd.Metar(nyoomicao[f]).getAttribute('changements')} \n auto : {gd.Metar(nyoomicao[f]).getAttribute('auto')} \n Wind : {gd.Metar(nyoomicao[f]).getAttribute('wind')} \n RVR : {gd.Metar(nyoomicao[f]).getAttribute('rvr')} \n Weather : {gd.Metar(nyoomicao[f]).getAttribute('weather')} \n Cloud : {gd.Metar(nyoomicao[f]).getAttribute('cloud')} \n tempretures : {gd.Metar(nyoomicao[f]).getAttribute('temperatures')} \n qnh : {gd.Metar(nyoomicao[f]).getAttribute('qnh')} \n visibility : {gd.Metar(nyoomicao[f]).getAttribute('visibility')} \n propertys : {gd.Metar(nyoomicao[f]).getAttribute('properties')} \n VMC : {gd.Metar(nyoomicao[f]).getAttribute('vmc')} \n")
print(f"Generating full report '{nyoomspot[f]} on {stmp}.txt'")
if (os.path.exists(f"C:/Users/{os.getlogin()}/AIRPORTREPORTS/")==False):
os.mkdir(f"C:/Users/{os.getlogin()}/AIRPORTREPORTS/")
with open(f"C:/Users/{os.getlogin()}/AIRPORTREPORTS/{nyoomspot[f]} on {stmp}.txt","w",encoding="utf-8") as frr:
frr.write(f"Details about Airport #{nyoomno[f]} + METAR REPORT \n=======================================\nName : {nyoomspot[f]} Longditude : {nyoomlon[f]}\nCountry : {nyoomcontroler[f]} Latitude : {nyoomlat[f]}\nA.L.No : {nyoomno[f]} Altitude : {nyoomalt[f]}\nIATA : {nyoomiata[f]} ICAO : {nyoomicao[f]}")
frr.write(f"\nAirport information : {c}")
However I am stonewalled when manually attempting to fetch info on a certain flight
For example
DL200 which is a flight from Atlanta USA to Gautueng SOUTH AFRICA
The so called JSON pharser cannot read the data because it doesnt comply with RFC 8259 , one such issue in the garbaled mess of data is the lack of doubble quotes , and the capitalisation of the first letter of booleans where they should be lowercase. Some values such as None get returned without being quoted with the doubbles , thus throws a missing value error
FOR MORE INFORMATION ON THE JAVA SCRIPT OBJECT NOTATION RFC 8259 STANDARD
REFER TO : https://www.rfc-editor.org/rfc/rfc8259
I want to modify one of the keys in the config dict but fail to do so. I even fail to feed back the read out parameters the following way (not exactly as shown in the documentation but how else can I call the set method?):
params = fr_api.get_real_time_flight_tracker_config()
fr_api.set_real_time_flight_tracker_config(params)
I get the following error:
TypeError: set_real_time_flight_tracker_config() takes 1 positional argument but 2 were given
Maybe I am not using your class correctly, but seems like I am giving only 1 positional argument. Could you give me a pointer on how to correctly feed in the config dictionary? Thanks!
so i want to make the api print details about the flight, either by putting in the registration, icao or idk whatever. just so i can get info abt an exact flight.
when i do:
flight_details = fr_api.get_flight_details(flight)
print(flight_details)
or anything in this direction (ive been trying for the last 3 hours 💀)
IT ALWAYS OUTPUTS EITHER:
Traceback (most recent call last):
File "/home/runner/test11112222/main.py", line 7, in
details = fr_api.get_flight_details(flight="-i put everything possible in here-")
File "/home/runner/test11112222/.pythonlibs/lib/python3.10/site-packages/FlightRadar24/api.py", line 297, in get_flight_details
response = APIRequest(Core.flight_data_url.format(flight.id),
AttributeError: 'str' object has no attribute 'id'
OR:
Traceback (most recent call last):
File "/home/runner/test11112222/main.py", line 7, in
details = fr_api.get_flight_details(flight_id="-i put everything possible in here-")
TypeError: FlightRadar24API.get_flight_details() got an unexpected keyword argument 'flight_id'
sorry if this is obviously easy to fix but im kind of new to python and i just cant get it to work.
thanks for the help in advance!
Hello, does this API allow for people to find the start/end times of an a flight? If I can not do this with this API, do you know of any free public ones that will let me? Thanks.
How to get a flight list?
Hi, first of all thank you for this script.
I was looking around and couldn't find any information on how to make date based queries, something that I'm very interested on.
The use case would be
Return all flights between date 01 and date 02 for airport X.
I'm not looking for the number of flights but the flight details, such as airline, that occured between those dates.
Is this possible to do with your script?
Thank you in advance!
Is there any way to get the flight information using the ICAO/callsign or the plane's HEX code?
Or is there a way to filter the result list using this information?
Thanks in advance.
Describe the bug
getAirlineLogo does not work in nodejs, for instance
iata = 'CDG';
icao = 'LFPG';
try { const airlineLogo = await frApi.getAirlineLogo(iata, icao); return airlineLogo; }
catch (error) { console.log(error); return error.message; }
Received status code '404: Not Found' for the URL https://www.flightradar24.com/static/images/data/operators/LFPG_logo0.png
I am trying to use this api but cant seem to find any documentation.
Hello,
firsty, I would like to thank you for creating FlightRadarAPI. My question is whether it is possible to get a flight from the list of flights by its registration number?
Also, I tried this basic example:
from FlightRadar24.api import FlightRadar24API
fr_api = FlightRadar24API()
flights = fr_api.get_flights()
for flight in flights:
print(flight)
details = fr_api.get_flight_details(flight.id)
flight.set_flight_details(details)
print("Flying to", flight.destination_airport_name)
But I get the following error on the fourt flight in the loop:
<(BALL) N256TH - Altitude: 59400 - Ground Speed: 8 - Heading: 305>
Traceback (most recent call last):
File "C:\Users\uporabnik\prog\letalo.py", line 9, in <module>
flight.set_flight_details(details)
File "C:\Users\uporabnik\AppData\Local\Programs\Python\Python310\lib\site-packages\FlightRadar24\flight.py", line 102, in set_flight_details
dest_aiport_code = dest_aiport.get("code", dict())
AttributeError: 'NoneType' object has no attribute 'get'
Do you know what might be causing it?
I will appreciate any help!
I'm collecting all arrival flights to certain airports. After a while I get this error: "CloudflareError: An unexpected error has occurred. Perhaps you are making too many calls?"
I can't replicate it. I also read the errors provided in this Code. But i wasn't able to solve it. I also set a sleep timer to 30 seconds.
Is there any possibility, to avoid this error?
Hi,
I'm trying to access airline fleet information from flightradar24. I understand the API does not provide functionality as this point. Can I get some guidance as to how I can do that?
For example: airline name is WestJet, and it contains 162 aircrafts. I would need details on aircraft type and details.
Thanks a lot!
A repeat of issue #31 except I couldn't find an answer. I'm using the Python library.
Any advice?! Thanks very much, other than that seems to be working well :)
Hi, sorry for creating an issue but i haven't found another way of getting in touch - I have a question with the "bounds" param in the get_flights() function. what type of coordinates am I supposed to use here and how can I convert these to the requested format for example for "austria" ? Any hint much appreciated...
Add data from https://www.flightradar24.com/data/statistics where one can see the total number of flights.
I'm a business plan subscriber and we're having problems fetching flights from a Start Time to an End Time.
We're interested in flights from 2022-09-04 to 2022-09-05.
Can someone elaborate how to get flights in this time frame via get_flights or any other API?
Is there more in-depth documentation Business-Subscribers can use besides that described here? https://pypi.org/project/FlightRadarAPI/
From FlightRadar24's website we're told we get 3 years of past flight history, yet; I don't see any documentation in the API as to how to retrieve flight data well within those 3 years in the API ?? Please Help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.