UsageFlow Flask
⚠️ Beta Notice: This package is currently in beta. While we strive to maintain stability, there may be breaking changes as we continue to improve the API.
The Flask package of UsageFlow provides easy integration with Flask applications for API usage tracking and management.
Installation
pip install usageflow-flask
Quick Start
from flask import Flask, jsonify
from usageflow.flask import UsageFlowMiddleware
app = Flask(__name__)
# Initialize UsageFlow middleware
UsageFlowMiddleware(
app,
api_key="your_api_key_here",
pool_size=10 # Optional: Number of WebSocket connections (default: 10)
)
@app.route("/api/v1/users")
def get_users():
return jsonify({"users": ["user1", "user2"]})
if __name__ == "__main__":
app.run()
Configuration
The middleware accepts the following parameters:
app: Your Flask application instance (required)api_key: Your UsageFlow API key (required)pool_size(optional): Number of WebSocket connections in the pool (default: 10)
Features
- Automatic request tracking
- JWT token extraction and validation
- Request/response metadata collection
- Rate limiting and quota management
- Endpoint blocking support
Development
To contribute to the project:
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
License
MIT License
Release files for usageflow-flask 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| usageflow_flask-0.3.5.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| usageflow_flask-0.3.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / usageflow_flask-0.3.5.tar.gz
| Download URL | usageflow_flask-0.3.5.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
081ef8b3911f819a8dedce15d6c1d1ba7633eabd43d1d27f04be5bc7cd31c7f3
|
|
BLAKE2b-256 checksum How to use checksums |
4e989b71f3616e0c598929493304c0324f0a43763673576d646809679035f3bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / usageflow_flask-0.3.5-py3-none-any.whl
| Download URL | usageflow_flask-0.3.5-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f653654575a89f73a416576b156f6ff03d964f981acbad52a618d517bf8e2193
|
|
BLAKE2b-256 checksum How to use checksums |
251150a20c374ff8f59f8d9e5068588848b715798930f085c5771d86d118f2e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|