nasawrapper.utils

Here, you’ll find functions that may be useful to you when making requests. Until now, there’s only one implementation: a function to see your reamining rate limit. Look at it below:

nasawrapper.utils.get_remaining_rate_limit(api_key: str) int

Returns your remaining rate limit by making a request to Apod and getting the header X-RateLimit-Remaining, that’s returned on every API response.

For example, if you are using an API key different from DEMO_KEY, you have a default hourly rate limit of 1.000 requests, acording to the Portal. So, if you make 2 requests, your remaining rate limit will be equal to 998.

Example

from nasawrapper.utils import get_remaining_rate_limit

remaining = get_remaining_rate_limit("DEMO_KEY")
print(reamining)