Skip to main content

Apitally client library for Python

Project description

Apitally logo

Your refreshingly simple REST API companion.

Apitally offers API traffic monitoring and integrated API key management that is extremely easy to set up and use with new and existing API projects. No assumptions made about your infrastructure, no extra tools for you to host and maintain.

🔗 apitally.io

Apitally screenshots


Apitally client for Python

Tests Codecov PyPI

This client library currently supports the following frameworks:

Install

Use pip to install and provide your framework of choice as an extra, for example:

pip install apitally[fastapi]

The available extras are: fastapi, starlette, flask, django_ninja and django_rest_framework.

Usage

Below are basic usage examples for each supported framework. For further instructions and examples, including how to identify consumers and use API key authentication, check out our documentation.

FastAPI

from fastapi import FastAPI
from apitally.fastapi import ApitallyMiddleware

app = FastAPI()
app.add_middleware(
    ApitallyMiddleware,
    client_id="your-client-id",
    env="your-env-name",
)

Starlette

from starlette.applications import Starlette
from apitally.starlette import ApitallyMiddleware

app = Starlette(routes=[...])
app.add_middleware(
    ApitallyMiddleware,
    client_id="your-client-id",
    env="your-env-name",
)

Flask

from flask import Flask
from apitally.flask import ApitallyMiddleware

app = Flask(__name__)
app.wsgi_app = ApitallyMiddleware(
    app,
    client_id="your-client-id",
    env="your-env-name",
)

Django Ninja

In your Django settings.py file:

MIDDLEWARE = [
    # Other middlewares first ...
    "apitally.django_ninja.ApitallyMiddleware",
]
APITALLY_MIDDLEWARE = {
    "client_id": "your-client-id",
    "env": "your-env-name",
}

Django REST Framework

In your Django settings.py file:

MIDDLEWARE = [
    # Other middlewares first ...
    "apitally.django_rest_framework.ApitallyMiddleware",
]
APITALLY_MIDDLEWARE = {
    "client_id": "your-client-id",
    "env": "your-env-name",
}

Getting help

If you need help please join our Apitally community on Slack or create a new discussion on GitHub.

License

This library is licensed under the terms of the MIT license.

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

apitally-0.1.2.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

apitally-0.1.2-py3-none-any.whl (20.0 kB view hashes)

Uploaded Python 3

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