Skip to main content

API Tackle - Simple Python REST API Framework

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_tackle-0.2.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

api_tackle-0.2-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file api_tackle-0.2.tar.gz.

File metadata

  • Download URL: api_tackle-0.2.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for api_tackle-0.2.tar.gz
Algorithm Hash digest
SHA256 8f5f4e4a86379508a60f3d08a986806c5798f85c02cef8f72db263934fefdbd4
MD5 319eaa44e5ae1912f65a7e22304b8e5d
BLAKE2b-256 1dc757ba36e6b174203b54aae8d324574271bf5c3058b7b5063bd44db83f516e

See more details on using hashes here.

File details

Details for the file api_tackle-0.2-py3-none-any.whl.

File metadata

  • Download URL: api_tackle-0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for api_tackle-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d4ed650f1b7dd5c69ced4bc6fc6eff662ac80b892e4573fb5ac7c58fd964a89
MD5 0aaf9557ea05f5b6916a7d1ab2823eb2
BLAKE2b-256 5cc742bb62bb464bfde51fcecc6c01977afcda8f0fa60eca2394622b95898e63

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page