Flask-Github-Webhook
Flask-Github-Webhook adds extension support for GitHub webhooks to Flask. This extension primarily extends the python-github-webhook project by making the Flask Extension Pattern available as an initialization option.
Initialization
The Github-Webhook Extension may be initialized directly or as an extension:
Direct Setup
from flask import Flask
from flask_github_webhook import GithubWebhook
app = Flask(__name__)
webhook = GithubWebhook(app)
Extension Setup
from flask import Flask
# The extension may be initialized from anywhere in the project, including
# inside this file, by calling GithubWebhook()
from .extension import WEBHOOK
app = Flask(__name__)
WEBHOOK.init_app(app)
Usage
The extension may be used in the same manner as python-github-webhook.
from .extension import WEBHOOK
@WEBHOOK.hook()
def push_handler(data):
print('Received the following PUSH event:{}'.format(data))
@WEBHOOK.hook(event_type='pull_request')
def pullrequest_handler(data):
print('Received the following PULL-REQUEST event:{}'.format(data))
Versions
Version 0.1.x supports ^2.7 and ^3.4.
Versions 0.2+ supports ^3.6.7. This is primarily due to Python version
constraints on the package and test tools. For instance, here are some
dependencies and their supported Python versions: poetry=^3.4,
coveralls=^3.5, pre-commit=^3.6.1, and pytest=^3.6. Due to these
constraints, the decision was made to drop official support for 2.7, 3.4
and 3.5. However, flask-github-webhook=^0.1.x should work for older
Python versions.
Configuration
The extension has the same configurations available as the python-github-webhook package. However, unlike referenced package, this extension reads those configurations from the Flask application, not initialization arguments. The values below should be configured in the Flask application (app.config) prior to initializing the extension.
GITHUB_WEBHOOK_ENDPOINT
This setting declares the route that all webhook event handlers will use. If left unset, the setting will default to the endpoint as declared in python-github-webook. As of this writing, the default endpoint is /postreceive.
GITHUB_WEBHOOK_SECRET
If provided, this setting's value should match the secret set in the GitHub repository from which this extension will receive webhooks.
Contributing
Contributions are welcomed! If you would like to improve or modify Flask-Github-Webhook, please follow these steps:
- Fork this repository.
- Make your changes and create a pull request.
- Ensure that all status checks are passing.
Author & License
This package is released under an open source MIT License. Flask-Github-Webhook was originally written by Shawn Wallis.
References
Metadata
Release files for flask-github-webhook 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask-github-webhook-0.2.0.tar.gz | 4.1 kB | Without provenance | Details for flask-github-webhook-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_github_webhook-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for flask_github_webhook-0.2.0-py3-none-any.whl |
Total release size: 8.7 kB
Release files / flask-github-webhook-0.2.0.tar.gz
| Download URL | flask-github-webhook-0.2.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd4579103bde71f520b82f57dfc34fdf2359b340b69b177aa908b9b22e3876dc
|
|
BLAKE2b-256 checksum How to use checksums |
54f61f09502db90c24aad0c6d2d193f8c3b91f3a3660df1ad23fcc3db69aeebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.3 Linux/5.3.0-1032-azure
|
Release files / flask_github_webhook-0.2.0-py3-none-any.whl
| Download URL | flask_github_webhook-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cfbb569f03b5a8bf5edd2681424ef8c3539838f9effadcd1383dbfa45a1324b
|
|
BLAKE2b-256 checksum How to use checksums |
b3eeecaa06fce5f34e6a5e9462ba27fb9c0c4e5cd1d4d3f8e5cd6f303799bb89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.3 Linux/5.3.0-1032-azure
|
Security for flask-github-webhook 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.