A Computable Datatrust implementation written in Python
Endpoints and available methods can be auto-discovered at {host_URL}/api/spec.json
Swagger docs for individual endpoints can be found at {host_URL}/api/v1/listing.help.html
or can be obtained programmatically at {host_URL}/api/v1/listing.help.json
Tested with Python 3.7. Other 3.x versions may work as well. Python2 will not work.
-
Create a python3.7 virtual environment
{PATH_TO_PYTHON_3.7} -m venv .env
-
Activate the virtual environment
source .env/bin/activate
-
Install dependencies
pip install -r requirements.txt
- For development work:
make dev
Dev requires a local dynamodb database. Download it here
- For production:
FLASK_CONFIGURATION=production FLASK_APP=app.py python -m flask run
Post data to the API endpoint api/v1/listing
Curl example:
curl -X POST \
http://localhost:5000/api/v1/listing \
-H 'Content-Type: application/json' \
-d '{
"listing": "willtest1",
"data": [
{"foo": "bar"},
{"baz": "bang"}
]
}'
listing
is required in the json payload, data
is currently not
-
make test
-
NOTE: Two warnings appear in test results due to unresolved deprecation warnings in Jinja2