Skip to main content

Aggregates and enhances carpooling-offers and publishes them as GTFS(-RT)

Project description

Amarillo

CRUD for carpool offers

An Amarillo is a yellow-dressed person helping others to find a car pool in Cuba.

Setup

  • Python 3.9.2 with pip
  • python3-venv

Create a virtual environment python3 -m venv venv.

Activate the environment and install the dependencies pip install -r requirements.txt.

Run uvicorn amarillo.main:app.

In development, you can use --reload.

Environment Variables

  • env
  • ADMIN_TOKEN

Security

All endpoints are protected by an API-Key in the HTTP header. There is a special admin user. For this user, the API-Key must be passed in as an environment variable when Amarillo is started.

The admin can create additional API-Keys in the /users endpoint. This endpoint is always available but not always shown in /docs, especially not when running in production. The Swagger docs for /users can be seen on the MFDZ demo server.

Permissions work this way

  • the admin is allowed to call all operations on all resources. Only the admin can create new API-Keys by POSTing an users JSON object to /users.
  • API-Keys for agencies are allowed to POST/PUT/GET/DELETE their own resources and GET some public resources.

Development

GTFS-RT python bindings

In case you modify or update the proto-files in amarillo/proto, you'll need to regenerate the python bindings. First, create the python files:

$ cd amarillo/proto
$ protoc --version
libprotoc 3.21.6
$ protoc --proto_path=. --python_out=../services/gtfsrt gtfs-realtime.proto realtime_extension.proto
$ sed 's/import gtfs_realtime_pb2/import amarillo.services.gtfsrt.gtfs_realtime_pb2/g' ../services/gtfsrt/realtime_extension_pb2.py | sponge ../services/gtfsrt/realtime_extension_pb2.py

Testing

In the top directory, run pytest amarillo/tests.

Docker

Based on tiangolo/uvicorn-gunicorn:python3.9-slim

  • build docker build -t amarillo --build-arg="PLUGINS=amarillo-metrics" .
  • run docker run --rm --name amarillo -p 8000:80 -e MAX_WORKERS="1" -e ADMIN_TOKEN=$ADMIN_TOKEN -e RIDE2GO_TOKEN=$RIDE2GO_TOKEN -e TZ=Europe/Berlin -v $(pwd)/data:/app/data amarillo

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

amarillo-0.0.16a1.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

amarillo-0.0.16a1-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

Details for the file amarillo-0.0.16a1.tar.gz.

File metadata

  • Download URL: amarillo-0.0.16a1.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for amarillo-0.0.16a1.tar.gz
Algorithm Hash digest
SHA256 90c6fc260b2aeaf258eb596645bc8c74a4a34cb67bb7663d50aeb01fc1dd86a4
MD5 eaf2d910920cfe5e3278af2a00dff2e2
BLAKE2b-256 e8a00aea29882f5c65d9af56bcc0188919cedfdd9850993f6fe73f223f2dd427

See more details on using hashes here.

File details

Details for the file amarillo-0.0.16a1-py3-none-any.whl.

File metadata

  • Download URL: amarillo-0.0.16a1-py3-none-any.whl
  • Upload date:
  • Size: 59.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for amarillo-0.0.16a1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd2c9690f4db278e7ed4e301b83ad839af320043861b836949c95216c864a82c
MD5 383cad9226a0a9fe6bf32584bf2bf7e6
BLAKE2b-256 9fbc323d846c67f3db85c1df7fcaa945025fb045503c59af9efb2895f1e7db98

See more details on using hashes here.

Supported by

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