An API Wrapper around NASA's Mars Rover Photos API written in Python; providing sync and async support.


Keywords
Mars, Photos, Api-Wrapper, Async, NASA, marsphotos, python
License
MIT
Install
pip install marsworks==0.7.0

Documentation

Python PyPI version Code style: black

Welcome!

Hi! Welcome to my repository Marsworks! (Name inspired from fate franchise ofc ;) ).

So, Marsworks is a fast and lightweight API wrapper around Mars Rover Photos API written in Python.

Let's see why you should or shouldn't use this wrapper in next sections.

Advantages

  • Sync & Async support with Async utilizing async-await syntax.
  • Fast, lightweight; and memory optimized.
  • Provides API request handling at really low as well as high level.
  • 100% API coverage.
  • Pagination supported.
  • Minimal dependency of just 1 for both sync & async support.

Disadvantages

  • No Caching.
  • No Ratelimit handling or request quering.
  • Not well tested.

Currently this project is under development and possibilities of breaking changes in near future is huge until 1.x release.


Getting Started

Installation

pip install -U marsworks

or

python -m pip install -U git+https://github.com/mooncell07/Marsworks.git

Usage

Async. usage

Getting photos on a particular sol taken by this rover, asynchronously.
import asyncio

import marsworks


client = marsworks.AsyncClient()


async def main(rover_name, sol) -> list:
    images = await client.get_photo_by_sol(rover_name, sol)  # You can pass camera too.
    return images


imgs = asyncio.run(main("Curiosity", 956))
print(imgs[0].img_src)
print(imgs[0].photo_id)
# and many more attributes!

Sync. usage

Getting photos on a particular sol taken by this rover, synchronously.
import marsworks


client = marsworks.SyncClient()


def main(rover_name, sol) -> list:
    images = client.get_photo_by_sol(rover_name, sol)  # You can pass camera too.
    return images


imgs = main("Curiosity", 956)
print(imgs[0].img_src)
print(imgs[0].photo_id)
# and many more attributes!

Links