eklem / justini

Just in time info when entering or exiting your home. Raspberry Pi Zero W + Waveshare e-paper display.
MIT License
1 stars 0 forks source link

Check for 429 HTTP status #16

Open eklem opened 4 years ago

eklem commented 4 years ago

https://api.met.no/doc/TermsOfService [...] Clients which don't follow the terms are liable to being throttled. This means requests will start getting a 429 HTTP status code instead of any content. Always check response Status headers and limit traffic immediately if this should happen. If you don't suspect you have excessive amounts of traffic, the problem is likely to be a breach of the TOS, usually lack of identification. [...]

If geting back 429, print out a warning on the page instead of the weather.

eklem commented 4 years ago

Split into one method/function to get fromAPI and two to show content, depending on the http response