api-tackle 0.2

Creator: railscoder56

Last updated:

Add to Cart

Description:

apitackle 0.2

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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.