Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout error #70

Closed
caro-acdm opened this issue Apr 29, 2024 · 3 comments
Closed

Timeout error #70

caro-acdm opened this issue Apr 29, 2024 · 3 comments
Labels
question Further information is requested

Comments

@caro-acdm
Copy link

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)'))

@caro-acdm caro-acdm added the question Further information is requested label Apr 29, 2024
@JeanExtreme002
Copy link
Owner

It is a connection problem on your network.

If you still have this problem, try inserting verify=False at this line. Let me know if it solves the problem.

It could even be your DNS resolver that is unable to resolve the FR's address.

@caro-acdm
Copy link
Author

caro-acdm commented Apr 30, 2024 via email

@JeanExtreme002
Copy link
Owner

I'm closing this issue for now.

If you get any problem else using the project, feel free to open another issue.

Best regards,
Jean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants