An ASGI framework to build HTTP API's from a Python module structure.
Go to file
Maxime Alves LIRMM@home 37104948ca working cli dbupdate (poetry run halfapi dbupdate) 2020-07-05 14:49:13 +02:00
conf merge avec cli_update_db 2020-07-03 11:58:13 +02:00
halfapi working cli dbupdate (poetry run halfapi dbupdate) 2020-07-05 14:49:13 +02:00
tests [WIP] Import halfapi OK dans test_jwt_middleware. 2020-07-03 21:39:59 +02:00
.gitignore Ajout JWTAuthenticationBackend (from https://github.com/amitripshtos/starlette-jwt/blob/master/starlette_jwt/middleware.py). 2020-07-02 15:11:11 +02:00
README.md some documentation, juste enough to start a halfAPI server 2020-07-04 05:29:27 +02:00
__init__.py [WIP] Import halfapi OK dans test_jwt_middleware. 2020-07-03 21:39:59 +02:00
poetry.lock ajout de la gestion des paramètres pour halform 2020-07-03 21:39:57 +02:00
pyproject.toml uvicorn not optional 2020-07-03 22:15:25 +02:00
pytest.ini [WIP] Pb import halfapi dans test_jwt_middleware. 2020-07-03 21:39:59 +02:00
requirements.txt merge avec cli_update_db 2020-07-03 11:58:13 +02:00

README.md

halfAPI

This Python-based ASGI application aims to provide the core functionality to multiple API domains.

It's developed at the LIRMM in Montpellier, France.

The name "halfAPI" comes from the deep relationship between it and halfORM, a project authored by Joël Maizi.

how-to

As the project uses the poetry package manager, you first have to install it globally. It will replace virtualenv, pip, etc...

pip install poetry

Be sur to include the bin directory of pip in your PATH.

Then, cd in the halfapi repo, and chose your python version :

poetry env use 3.8

  • at this point, every time you come into the folder, when you launch something with "poetry run", it is launched within the virtual environment for this project -

And install the deps :

poetry install

If you need a domain, i.e: organigramme, just add -E organigramme avec install.

poetry install -E organigramme

Then, to run the server :

poetry run halfapi

If you need to launch the test suite (only works if you have pytest installed) :

poetry run pytest

API database

You just need to run the following command to insert the right data into the api database :

poetry run halfapi dbupdate

API database configuration

You can set the HALFORM_SECRET and HALFORM_DSN variables to setup the way you connect to the API database.

HALFORM_SECRET="wtfqwertz" HALFORM_DSN="dbname=api user=api password=api host=127.0.0.1 port=5432"

Warning

For the domains' databases, for now the database connection string is hardcoded (check app.mount_domains).

@TODO find a modular way to configure the database connection for each mounted domain