×

Notice

The forum is in read only mode.

PI in Python

4 years 11 months ago #982 by ldk
PI in Python was created by ldk
Hi,
I try to get the states at a specific epoch and I get some unexplained failing queries (I connect with my username/passwork)

This works:
states = api.get_states(time_secs = datetime.now(), bbox=(50.55, 51.2, 3.4, 5.2))

These fail: (states returns None)
states = api.get_states(time_secs = 1564298732, bbox=(50.55, 51.2, 3.4, 5.2))
states = api.get_states(time_secs = datetime(2019,7,27,23,3,28), bbox=(50.55, 51.2, 3.4, 5.2))

Any idea what I am doing wrong?
Do you need the exact time_secs to get results?
It it possible to query a time window?
Thanks,
Luc
4 years 11 months ago #983 by jluebbe
Replied by jluebbe on topic PI in Python
In find this in the documentation of the API at opensky-network.org/apidoc/
"OpenSky users can retrieve data of up to 1 hour in the past. If the time parameter has a value t<now−3600 the API will return 400 Bad Request."
Your timestamp looks much older.
The following user(s) said Thank You: ldk
4 years 11 months ago #984 by ldk
Replied by ldk on topic PI in Python
That answers my question on the query but leaves without option to reach my goal.
I am trying to link noise events in (logged) noise measurements to aircraft positions. It there a way to get access to that kind of historical data for scientific purposes?
Luc
4 years 11 months ago #985 by jluebbe
Replied by jluebbe on topic PI in Python
You could apply for historical data access and use the traffic library if you got access:
github.com/xoolive/traffic
The following user(s) said Thank You: strohmeier
4 years 11 months ago #986 by strohmeier
Replied by strohmeier on topic PI in Python
Luc even has access already. In this case, the live API also supports requests older than 1 hour. I've personally never used our Python wrapper for the API but if you authenticate, it should work. You should probably just test this quickly in a browser with your credentials.
4 years 11 months ago #988 by ldk
Replied by ldk on topic PI in Python
I use my credentials and the script runs without error. Is it possible that the API doesn't indicate that the credentials didn't work and you end up (without information) with an API instance with limited access?
Since I need a lot of data it is easier to submit a full request for data (submitted a few minutes ago...). that's more efficient then performing the queries myself.
THanks,
Luc
4 years 11 months ago #989 by strohmeier
Replied by strohmeier on topic PI in Python
Hi Luc,

I think you might have misunderstood, we cannot run queries for you, we are very time-constraint volunteers. ;) The data access form simply grants you access to the historical data. But as I said, you have that access already anyway?!
Powered by Kunena Forum
This website uses cookies to offer you the best experience of our services. By using this website you agree to our privacy policy!