API Tackle - Simple Python REST API Framework:
Simple Python REST API Framework …
Quickstart
See https://github.com/praekelt/api-tackle-example-app for an example of how to build an API-Tackle application.
A simple wsgi example application looks like:
""" WSGI Flask App for production hosting with e.g.: gunicorn --bind 0.0.0.0:80 -w 1 -t 120 wsgi """
import os
import logging
from tackle.flask_utils import create_flask_app # noqa
from tackle.flask_utils import setup_logging # noqa
from tackle.prometheus_utils import create_prometheus_server # noqa
from tackle.rest_api.wrapper_util import add_auth_token # noqa
from my_api.rest_api import get_path # noqa
create_prometheus_server(9100)
setup_logging(requested_logging_path='~/.tackle/logs',
include_prometheus=True)
flask_app = create_flask_app(specification_dir=get_path() + '',
add_api=True,
swagger_ui=True,
database_url='sqlite://',
database_create_tables=True,
debug=False)
# === Add some auth tokens to the DB ===
add_auth_token('tackleb6-12dd-4104-a7b6-f7d369ff5fec', "Default token e.g. internal hosting.")
# === ===
logging.info(f"rest_wsgi_app.py: __name__ == {__name__}")
application = flask_app.app
if __name__ == "__main__":
logging.info(f"rest_wsgi_app.py: __main__ Starting Flask app in Python __main__ .")
flask_app.run()
Building your own API
…
Metadata
Release files for api-tackle 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| api_tackle-0.2.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| api_tackle-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.2 kB
Release files / api_tackle-0.2.tar.gz
| Download URL | api_tackle-0.2.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f5f4e4a86379508a60f3d08a986806c5798f85c02cef8f72db263934fefdbd4
|
|
BLAKE2b-256 checksum How to use checksums |
1dc757ba36e6b174203b54aae8d324574271bf5c3058b7b5063bd44db83f516e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Release files / api_tackle-0.2-py3-none-any.whl
| Download URL | api_tackle-0.2-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d4ed650f1b7dd5c69ced4bc6fc6eff662ac80b892e4573fb5ac7c58fd964a89
|
|
BLAKE2b-256 checksum How to use checksums |
5cc742bb62bb464bfde51fcecc6c01977afcda8f0fa60eca2394622b95898e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|