Star us on GitHub
Star
Company
Open Source
Mission & Values
Getting Started
Overview
Fullstack Mapping
Backend / Server
Frontend / Client
Fullstack Frameworks
Session Replay
Console Messages
HTML iframe Recording
Identifying Users
Live Mode
Network DevTools
Privacy
Rage Clicks
Recording Network Requests and Responses
Session Sharing
Session Shortcut
Tracking Events
Versioning Sessions
Error Monitoring
Error Sharing
Grouping Errors
Sourcemaps
Versioning Errors
Product Features
Alerts
Analytics
Canvas
Comments
Cross Origin Iframe Recording
Digests
Environments
Frontend Observability
Keyboard Shortcuts
Performance Data
Segments
Session Search
Team Management
User Feedback
Web Vitals
WebGL
Integrations
Amplitude Integration
Clearbit Integration
ClickUp Integration
Discord Integration
Electron Support
Front Plugin
Height Integration
Intercom Integration
Linear Integration
Mixpanel Integration
React.js Integration
Segment Integration
Sentry Integration
Slack Integration
Vercel Integration
highlight.run Changelog
5.0.0
5.0.1
5.1.0
5.1.1
5.1.2
5.1.3
5.1.4
5.1.5
5.1.6
5.1.7
5.1.8
5.2.0
5.2.1
5.2.2
5.2.3
Tips
Content-Security-Policy
Local Development
Monkey Patches
Performance Impact
Proxying Highlight
Session Search Deep Linking
Troubleshooting
Upgrading Highlight
Menu
Docs / Welcome to Highlight / Getting Started / Backend / Server / Python Backend

Python Backend

Highlight ships the highlight_io pypi module for capturing backend errors in applications with Python backends.

Usage

The usage of this Backend SDK requires one of our Client SDKs to be installed, so please follow the instructions there if you have not done so.

The highlight_io Python Module

If you'd like to follow an example, check out our repo for one of a Flask app and one of a backend script.

First, import the package

poetry add highlight-io # or with pip pip install highlight-io
Copy

If you are uswing a Flask app, you'll need the Flask integration.

poetry add highlight-io[Flask] # or with pip pip install highlight-io[Flask]
Copy
Adding Highlight to Flask

Import the Flask integration and setup Highlight with Flask!

from flask import Flask import highlight_io from highlight_io.integrations.flask import FlaskIntegration app = Flask(__name__) H = highlight_io.H( "YOUR-PROJECT-ID", integrations=[FlaskIntegration()], record_logs=True )
Copy
Verify

To validate your Highlight backend setup, you can setup up a testing route handler that throws an error. For example:

import logging import random import time from flask import Flask import highlight_io from highlight_io.integrations.flask import FlaskIntegration app = Flask(__name__) H = highlight_io.H( "YOUR_PROJECT_ID", integrations=[FlaskIntegration()], record_logs=True ) @app.route("/error") def hello(): for idx in range(1000): logging.info(f"hello {idx}") time.sleep(0.001) if random.randint(0, 100) == 1: raise Exception(f"random error! {idx}") logging.warning("made it outside the loop!") return "<h1>Hello, World!</h1>" if __name__ == "__main__": app.run()
Copy

creates a /error route that will randomly throw an error.

To view and resolve the recorded error, log into app.highlight.io/errors. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. Check out the error monitoring docs for more info!