Skip to main content

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:

  1. Clone the repository
  2. Install development dependencies:
    pip install -e ".[dev]"
    
  3. 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)

Source distribution for usageflow-flask 0.3.5
File Size Uploaded
usageflow_flask-0.3.5.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for usageflow-flask 0.3.5
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page