A Python package for tracking Flask errors via GitHub Issues.
Project description
flask-github-issues
flask-github-issues is an extension for Flask that makes it easy to send unhandled errors directly from your application to GitHub Iusses.
An Example:
pip install flask_github_issues
extensions.py
from flask_github_issues import ErrorTracking
gitub_error_tracking = ErrorTracking()
init.py
from flask import Flask, request, session
import traceback
from .extensions import gitub_error_tracking
def create_app(config_env=os.getenv("ENV"), register_blueprints=True):
app = Flask(__name__)
gitub_error_tracking.init_app(app)
@app.errorhandler(Exception)
def internal_server_error(e):
if request.path.startswith("/static/"):
# Return a simple 500 response without rendering a template
return "", 500
else:
error_msg = traceback.format_exc()
user_email = session.get("email", "unknown")
github_error_tracking.track_error(error_message=str(error_msg),
details=[
{"User Email": user_email},
{"URL": request.url},
{"Tenant": "TEST"},
],
)
return render_template("500.html"), 500
config.py:
class Config:
GH_TOKEN = os.getenv("GH_TOKEN")
GH_REPO = os.getenv("GH_REPO")
GH_ASSIGNEES = ["ghawes85"]
GH_LABELS = ["bug"]
GH_TYPES = "bug" # Types is being released in the GitHub API. Currently if it is rolled out for you or your org, then can add one type
- Repo is in the form org/repo_name or user/repo_name
- Token is a Github fine-grained personal access token
- Assignees is a list of of users you want the ticket to be assigned to
- Labels is a list of labels you want assigned to your ticket
As an example and using the follow route:
@app.route("/error")
def error():
raise ValueError("This is a test Value ERROR")
The following issue is created in GitHub
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_github_issues-0.1.5.tar.gz.
File metadata
- Download URL: flask_github_issues-0.1.5.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b4bfe57420575a35fcfbb54399ca3c0e0043fddac2b018b63a291ef151a3c4a
|
|
| MD5 |
73ff48638340f74b3d9692e066b325ad
|
|
| BLAKE2b-256 |
3344ae229521219296d9bdd002b03cfa9e9d0f689d0416258ea83ac734f6cc09
|
Provenance
The following attestation bundles were made for flask_github_issues-0.1.5.tar.gz:
Publisher:
pypi_publish.yaml on Pontem-Innovations/flask-github-issues
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_github_issues-0.1.5.tar.gz -
Subject digest:
3b4bfe57420575a35fcfbb54399ca3c0e0043fddac2b018b63a291ef151a3c4a - Sigstore transparency entry: 832246169
- Sigstore integration time:
-
Permalink:
Pontem-Innovations/flask-github-issues@407258388f3f13df71d830f7c32ebb638e9aa9aa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Pontem-Innovations
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yaml@407258388f3f13df71d830f7c32ebb638e9aa9aa -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file flask_github_issues-0.1.5-py3-none-any.whl.
File metadata
- Download URL: flask_github_issues-0.1.5-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae71eb1956607d2f57345b07ffd48a1b5addf97712f0a1c4ee06960e594657cf
|
|
| MD5 |
08967004b0f3a22523d027c21f68f73a
|
|
| BLAKE2b-256 |
3a46d1b0aee18105d7eb07665b444721702b55672bb0ca18f61744ba3a99e166
|
Provenance
The following attestation bundles were made for flask_github_issues-0.1.5-py3-none-any.whl:
Publisher:
pypi_publish.yaml on Pontem-Innovations/flask-github-issues
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_github_issues-0.1.5-py3-none-any.whl -
Subject digest:
ae71eb1956607d2f57345b07ffd48a1b5addf97712f0a1c4ee06960e594657cf - Sigstore transparency entry: 832246173
- Sigstore integration time:
-
Permalink:
Pontem-Innovations/flask-github-issues@407258388f3f13df71d830f7c32ebb638e9aa9aa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Pontem-Innovations
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yaml@407258388f3f13df71d830f7c32ebb638e9aa9aa -
Trigger Event:
workflow_dispatch
-
Statement type: