adafruit / Adafruit_CircuitPython_Requests

Requests-like interface for web interfacing
MIT License
51 stars 37 forks source link

Add OpenSky-Network API example #133

Closed DJDevon3 closed 1 year ago

DJDevon3 commented 1 year ago

Free public limit is 100 calls per day and maximum of 60 seconds each or you'll get temp banned. You get 4000 calls if you login but I haven't figured out how with a microcontroller yet. They have no token system and their API is primarily built for python & curl. It's a foot in the door for public access to flight data.

DJDevon3 commented 1 year ago

Figured out how to authenticate a login. It was not easy and there was almost no documentation. Authentication via REST GET is undocumented. Just figured it out from hints reading their forums. Added a public & private API. There's huge difference in the amount of calls per day and rate limiting if you're authenticated or not.

DJDevon3 commented 1 year ago

The private_area example is while being authenticated (use website login credentials) and shows all air traffic in a lat/lon geographic area. You're going to want to review this on an S2 or S3. It will return a good amount of data depending on how large of a geographic area you select. The default area I put in is the Orlando airport area so there's always bound to be some traffic happening.

OpenSky_Area_API

DJDevon3 commented 1 year ago

Oops yes. About halfway through became unsure if everything should be in 0 UTC or add the option for timezone offsets. I think all flight times are returned as 0 UTC because flights can easily cross multiple timezones. Also if a geographic area is large enough it's possible for the area itself to span multiple time zones. The example in their API is the entire country of Switzerland. No way you'd want to do the entire USA it would crash the microcontroller due to lack of ram allocation. Easier keep everything in 0 UTC and also recommend a small area. If a user wants to add the timezone for a lat/lon area that will be up to them. Will clean it up. Nice catch. Thank you.