Tool for handling Git webhooks
This is a simple tool that will help you handle Git webhooks. Now it supports the following services:
pip install gwh
If you want to handle any event from any repository:
from gwh import GitWebhook gwh = GitWebhook() @gwh.handle() def event(): print(gwh.event['repository']) print(gwh.event['type']) print(gwh.event['affected_branches']) print(gwh.event['raw_data'])
If you want to handle push from specific repository:
@gwh.handle(repository="user/repo", types=['push']) def event(): if "dev" in gwh.event['affected_branches']: print("pushed")
Finally, you need to pass request from your webserver to GitWebhook handler. It will be Flask in this example:
from flask import Flask, request app = Flask(__name__) @app.route("/") def webhook(): gwh.handle_request(request.headers, request.data)
Bug reports, feature requests, pull requests, any feedback, etc. are welcome.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size gwh-0.1.12.tar.gz (3.8 kB)||File type Source||Python version None||Upload date||Hashes View|