Treblle with Flask
Requirements
Section titled “Requirements”- requests
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”You can use Treblle with Flask by importing the Treblle class and passing your Flask app to the constructor.
from treblle_flask import Treblle
app = Flask(__name__)Treblle(app)
@app.route('/hello')def hello(): return 'Hello, World!'Advanced Usage
Section titled “Advanced Usage”You can also pass your Treblle API key and project ID to the Treblle constructor.
from treblle_flask import Treblle
app = Flask(__name__)Treblle(app, TREBLLE_API_KEY="YOUR_API_KEY", TREBLLE_PROJECT_ID="YOUR_PROJECT_ID")
@app.route('/hello')def hello(): return 'Hello, World!'Environment Variables
Section titled “Environment Variables”You can set the following environment variables to configure Treblle without passing any arguments to the Treblle constructor:
TREBLLE_API_KEY: Your Treblle API keyTREBLLE_PROJECT_ID: Your Treblle project ID