Skip to main content

Sensor Tasking API (STAPI) with FastAPI

Project description

STAPI FastAPI - Sensor Tasking API with FastAPI

WARNING: The whole STAPI spec is very much a work in progress, so things are guaranteed to be not correct.

Usage

STAPI FastAPI provides an fastapi.APIRouter which must be included in fastapi.FastAPI instance.

Pagination

4 endpoints currently offer pagination: GET: '/orders, /products, /orders/{order_id}/statuses POST: /opportunities.

Pagination is token based and follows recommendations in the STAC API pagination. Limit and token are passed in as query params for GET endpoints, and via the body as separate key/value pairs for POST requests.

If pagination is available and more records remain the response object will contain a next link object that can be used to get the next page of results. No next Link returned indicates there are no further records available.

limit defaults to 10 and maxes at 100.

ADRs

ADRs can be found in in the adrs directory.

Development

It's 2024 and we still need to pick our poison for a 2024 dependency management solution. This project picks poetry for now.

Dev Setup

Setup is managed with poetry and pre-commit. It's recommended to install the project into a virtual environment. Bootstrapping a development environment could look something like this:

python -m venv .venv
source .venv/bin/activate
pip install poetry  # if not already installed to the system
poetry install --with dev
pre-commit install

Test Suite

A pytest based test suite is provided, and can be run simply using the command pytest.

Dev Server

This project cannot be run on its own because it does not have any backend implementations. However, a minimal test implementation is provided in ./tests/application.py. It can be run with uvicorn as a way to interact with the API and to view the OpenAPI documentation. Run it like so from the project root:

uvicorn application:app --app-dir ./tests --reload

With the uvicorn defaults the app should be accessible at http://localhost:8000.

Implementing a backend

  • The test suite assumes the backend can be instantiated without any parameters required by the constructor.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stapi_fastapi-0.7.0a1.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

stapi_fastapi-0.7.0a1-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file stapi_fastapi-0.7.0a1.tar.gz.

File metadata

  • Download URL: stapi_fastapi-0.7.0a1.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stapi_fastapi-0.7.0a1.tar.gz
Algorithm Hash digest
SHA256 29359a88f95122c7efd97aeaa52f5844ce627018bacdd90fb9921ad690612e85
MD5 3edfa8c9737d7dd2d59c2f74f73b20ad
BLAKE2b-256 adc843d0eb40ba4831c76834ccc1a07e54758ddad5c06fd4d5363f945054da48

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapi_fastapi-0.7.0a1.tar.gz:

Publisher: python-publish.yml on stapi-spec/stapi-fastapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stapi_fastapi-0.7.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for stapi_fastapi-0.7.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 887a6778c7be5cdb0c41cc2cc7c54d2867fb615a3d153a0386ef2efbd40a1bc7
MD5 93796504773f942b81d8bf654f7c7fa6
BLAKE2b-256 5158b86a94b78701cea8ec59263e65ece5d6e5eeea8de09365a9c05db99d33e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapi_fastapi-0.7.0a1-py3-none-any.whl:

Publisher: python-publish.yml on stapi-spec/stapi-fastapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page