Simple API monitoring & analytics for REST APIs built with FastAPI, Flask, Django, Starlette, Litestar and BlackSheep.
Project description
API monitoring & analytics made simple
Real-time metrics, request logs, and alerts for your APIs — with just a few lines of code.
Apitally SDK for Python
This SDK for Apitally currently supports the following Python web frameworks:
Learn more about Apitally on our 🌎 website or check out the 📚 documentation.
Key features
API analytics
Track traffic, error and performance metrics for your API, each endpoint and individual API consumers, allowing you to make informed, data-driven engineering and product decisions.
Error tracking
Understand which validation rules in your endpoints cause client errors. Capture error details and stack traces for 500 error responses, and have them linked to Sentry issues automatically.
Request logging
Drill down from insights to individual requests or use powerful filtering to understand how consumers have interacted with your API. Configure exactly what is included in the logs to meet your requirements.
API monitoring & alerting
Get notified immediately if something isn't right using custom alerts, synthetic uptime checks and heartbeat monitoring. Notifications can be delivered via email, Slack or Microsoft Teams.
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
, flask
, django_rest_framework
,
django_ninja
, starlette
, litestar
and blacksheep
.
Usage
Our setup guides include all the details you need to get started.
FastAPI
This is an example of how to add the Apitally middleware to a FastAPI application. For further instructions, see our setup guide for FastAPI.
from fastapi import FastAPI
from apitally.fastapi import ApitallyMiddleware
app = FastAPI()
app.add_middleware(
ApitallyMiddleware,
client_id="your-client-id",
env="dev", # or "prod" etc.
)
Django
This is an example of how to add the Apitally middleware to a Django Ninja or Django REST Framework application. For further instructions, see our setup guide for Django.
In your Django settings.py
file:
MIDDLEWARE = [
"apitally.django.ApitallyMiddleware",
# Other middleware ...
]
APITALLY_MIDDLEWARE = {
"client_id": "your-client-id",
"env": "dev", # or "prod" etc.
}
Flask
This is an example of how to add the Apitally middleware to a Flask application. For further instructions, see our setup guide for Flask.
from flask import Flask
from apitally.flask import ApitallyMiddleware
app = Flask(__name__)
app.wsgi_app = ApitallyMiddleware(
app,
client_id="your-client-id",
env="dev", # or "prod" etc.
)
Starlette
This is an example of how to add the Apitally middleware to a Starlette application. For further instructions, see our setup guide for Starlette.
from starlette.applications import Starlette
from apitally.starlette import ApitallyMiddleware
app = Starlette(routes=[...])
app.add_middleware(
ApitallyMiddleware,
client_id="your-client-id",
env="dev", # or "prod" etc.
)
Litestar
This is an example of how to add the Apitally plugin to a Litestar application. For further instructions, see our setup guide for Litestar.
from litestar import Litestar
from apitally.litestar import ApitallyPlugin
app = Litestar(
route_handlers=[...],
plugins=[
ApitallyPlugin(
client_id="your-client-id",
env="dev", # or "prod" etc.
),
]
)
BlackSheep
This is an example of how to add the Apitally middleware to a BlackSheep application. For further instructions, see our setup guide for BlackSheep.
from blacksheep import Application
from apitally.blacksheep import use_apitally
app = Application()
use_apitally(
app,
client_id="your-client-id",
env="dev", # or "prod" etc.
)
Getting help
If you need help please create a new discussion on GitHub or join our Slack workspace.
License
This library is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file apitally-0.20.0.tar.gz
.
File metadata
- Download URL: apitally-0.20.0.tar.gz
- Upload date:
- Size: 142.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8d47a1edefa033c939d4992448551276f2651a6b698f288f67646c74bbbe55f5
|
|
MD5 |
89acf6b7d726f8c2f3ca681a9794405c
|
|
BLAKE2b-256 |
419ce91dede5f9beed620cb80c67a0651e913f83a9ab9e3cfac25789f4ecc0eb
|
File details
Details for the file apitally-0.20.0-py3-none-any.whl
.
File metadata
- Download URL: apitally-0.20.0-py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5d8a06b9119b6dc149c95a045dacce743024a6180c19d98956135600589e241c
|
|
MD5 |
e254d1dc2060208ada85e1464da243ba
|
|
BLAKE2b-256 |
e83a12249a494ccb6a3b98f8cc95bafac6aaeed342e7975a83c49d8ffe478166
|