Insight API Reference

This page provides a breakdown of the aionasa InSight (Mars Weather Data) module.

In-depth documentation for this API can be found at https://api.nasa.gov/assets/insight/InSight%20Weather%20API%20Documentation.pdf

Parameters for InSight API:

  • version: The version of this API. Locked to 1.0 currently.

  • feedtype: The format of what is returned. Currently the default is JSON and only JSON works.

Client

class aionasa.insight.InSight(api_key='DEMO_KEY', session=None, rate_limiter=<insight_rate_limiter>, **kwargs)

Client for NASA Insight Mars weather data.

Parameters
  • api_key (str) – NASA API key to be used by the client.

  • session (Optional[aiohttp.ClientSession]) – Optional ClientSession to be used for requests made by this client. Creates a new session by default.

  • rate_limiter (Optional[RateLimiter]) – Optional RateLimiter class to be used by this client. Uses the library’s internal global rate limiting by default.

await get(feedtype='json')

Retrieves Mars weather data from the last seven available days.

Parameters

feedtype (str) – The format of what is returned. Currently the default is JSON and only JSON works.

Returns

A dict containing JSON data returned by the API.

Return type

dict

Example Code

import asyncio
import json
from aionasa import InSight

async def main():
    async with InSight() as insight:
        data = await insight.get()

    print(json.dumps(data, indent=2))

asyncio.run(main())