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

Can't retrieve live state information from opensky #460

Closed
4 tasks done
simonrp84 opened this issue Aug 19, 2024 · 4 comments
Closed
4 tasks done

Can't retrieve live state information from opensky #460

simonrp84 opened this issue Aug 19, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@simonrp84
Copy link
Contributor

simonrp84 commented Aug 19, 2024

Hello!
If I try to use the api_states call to retrieve live information from the opensky data via traffic then I get this error message:

Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Client error '401 ' for url 'https://opensky-network.org/api/states/all'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time
Retrying in 10 seconds... {retry} more time

And the states are not retrieved.
My code is:

from traffic.data import opensky
sv = opensky.api_states()

This is not an issue with my machine being blocked by opensky as I can use curl https://opensky-network.org/api/states/all to successfully retrieve the states. I have added my login information to the traffic.conf file and have also tried without my credentials being in that file.

Any suggestions for what could be wrong?

If helpful, the debug info is:

DEBUG:httpcore.connection:close.started
DEBUG:httpcore.connection:close.complete
DEBUG:httpcore.connection:connect_tcp.started host='opensky-network.org' port=443 local_address=None timeout=5.0 socket_options=None
DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7fda81e29a30>
DEBUG:httpcore.connection:start_tls.started ssl_context=<ssl.SSLContext object at 0x7fda81e0c150> server_hostname='opensky-network.org' timeout=5.0
DEBUG:httpcore.connection:start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7fda81e29370>
DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore.http11:send_request_headers.complete
DEBUG:httpcore.http11:send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore.http11:send_request_body.complete
DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 403, b'', [(b'Server', b'nginx/1.17.6'), (b'Date', b'Mon, 19 Aug 2024 09:01:34 GMT'), (b'Transfer-Encoding', b'chunked'), (b'Connection', b'keep-alive'), (b'X-Content-Type-Options', b'nosniff'), (b'X-XSS-Protection', b'1; mode=block'), (b'Cache-Control', b'no-cache, no-store, max-age=0, must-revalidate'), (b'Pragma', b'no-cache'), (b'Expires', b'0'), (b'X-Frame-Options', b'DENY')])
INFO:httpx:HTTP Request: GET https://opensky-network.org/api/states/all "HTTP/1.1 403 "
DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore.http11:receive_response_body.complete
DEBUG:httpcore.http11:response_closed.started
DEBUG:httpcore.http11:response_closed.complete

Please follow these steps to make it more efficient to solve your issue:

  • Search for duplicate issues.
  • Use the latest version of traffic, ideally the HEAD of the github, and activate the DEBUG logging level.
  • Describe how to reproduce the bug and include the full code and data to reproduce it, ideally using a sample trajectory from the library. Sample trajectories are extensively used in the tests suite.
  • Limit the output of your exceptions to what is strictly necessary.

You may activate the DEBUG level with the following snippet:

import logging
logging.basicConfig(level=logging.DEBUG)
@simonrp84 simonrp84 added the bug Something isn't working label Aug 19, 2024
@simonrp84
Copy link
Contributor Author

For what it's worth, I am aware of: #413, which is also mine, but this appears to be a different issue. In that case I couldn't retrieve the states via curl and so it was an opensky issue. Here I can successfully retrieve the states outside of traffic so it's a library problem I think. Hence opening a new issue - apologies if you would have preferred I re-opn the old issue!

@xoolive
Copy link
Owner

xoolive commented Aug 19, 2024

Hi Simon, that is weird as I cannot reproduce on my side.
Are you using the latest version of pyopensky?
If yes, can you check with the HEAD of the repository?

@xoolive
Copy link
Owner

xoolive commented Sep 4, 2024

Hi @simonrp84 I published this morning a new version of pyopensky (wrapped by traffic) to better handle this kind of errors, can you try again? If it fails, please reopen another issue in pyopensky.

@xoolive xoolive closed this as completed Sep 4, 2024
@simonrp84
Copy link
Contributor Author

Sorry for not getting back to you on this - busy few weeks!
Will try with pyopensky as requested in the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants