Utilities¶
API shared by all modules.
BaseClient¶
The client class all aionasa API clients inherit from.
- class aionasa.BaseClient(api_key='DEMO_KEY', session=None, rate_limiter=None, timeout=None)¶
Base class for NASA API clients.
Asset¶
Base class for an image asset at a URL.
- class aionasa.Asset(client, url, filename)¶
Generic class representing a file asset URL.
- await read(url=None)¶
Downloads the file associated with this Asset.
- Parameters
url (
str) – The URL to download the asset from, for subclasses with multiple options.- Returns
The file, downloaded from the URL.
- Return type
bytes
- await save(path=None, url=None)¶
Downloads the file associated with this Asset and saves to the requested path.
- Parameters
url (
str) – The URL to download the asset from, for subclasses with multiple options.path – The file path at which to save the file. If
None, saves the image to the working directory using the filename from the asset url.
RateLimiter¶
Class used internally by aionasa API clients to follow NASA API rate limits.
- class aionasa.RateLimiter(limit, _repr=None)¶
Class that handles rate limit across the whole library. This is necessary to ensure observation of rate limits even if multiple API endpoints are being used.
- property remaining¶
The number of requests remaining. Starts at the total request count specified on initialization and updates on each API request.
- Type
int