How to set API refresh time

Hello again!
My question is about fair API usage. My app objetctive is to show the next International space station (ISS) pass. As I can retrieve the next passes, i want to do the http request only after the next pass. But I don’t know how I should implement it, since I can’t really understand how Tidbyt servers will call my app.

For example, when my app starts, it dees a request via API and lets imagine it says the next ISS pass is tomorrow at 21:00. I want my app to only do the next request at 21:01, so it don’t consume too much API calls and resources.

My question is not properly about coding, but to understand how tidbyt servers run the app. Of course, any help with examples is great.

My other solution is to call the request every 90 minutes (using ttl_seconds = 5400), cause is the least time possible between each ISS pass.

Yes, you can use the time module to calculate the number of seconds until the next ISS pass and then cache the response for that many seconds by passing it to ttl_seconds.

The cache key is formed by the http url and headers. In your case, the URL has the latitude and longitude of the user. This means that if I have the app installed and you too, then these installations won’t be able to share the cache since the API url called is different.

In this case, if you know the data can be cached for many hours, than it’s a good idea to do it!