An ASGI framework to build HTTP API's from a Python module structure.
Go to file
Maxime Alves LIRMM@home 1aba6b5623 [cli] add apihost and apiport options to dbupdate 2020-07-12 22:00:52 +02:00
conf [conf] removed HALFORM_DSN from the env parameters, added support for the 2020-07-09 10:23:13 +02:00
halfapi [cli] add apihost and apiport options to dbupdate 2020-07-12 22:00:52 +02:00
tests [debug] better handling of debug routes 2020-07-10 12:58:53 +02:00
.gitignore [middleware] put AclCallerMiddleware in lib file 2020-07-08 17:12:58 +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 [conf] removed HALFORM_DSN from the env parameters, added support for the 2020-07-09 10:23:13 +02:00
pyproject.toml [conf] removed HALFORM_DSN from the env parameters, added support for the 2020-07-09 10:23:13 +02:00
pytest.ini [test] add default DEBUG flag for pytest, add tests for jwt_middleware 2020-07-09 10:29:17 +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