Routes bitbucket webhook API event payloads to easily consumable decorators with payload serialized to python objects.
Project description
bitbucket-webhooks-router
Python library that makes webhook API event payloads available via decorators with payload serialized into python objects.
Installation
$ pip install bb-hooks-router
Quickstart
from bitbucket_webhooks_router import event_schemas
from bitbucket_webhooks_router import hooks
from bitbucket_webhooks_router import router
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route("/hooks", methods=["POST"])
def bb_webhooks_handler():
router.route(request.headers["X-Event-Key"], request.json)
return ("", 204)
@hooks.repo_push
def _handle_repo_push(event: event_schemas.RepoPush):
print(f"One or more commits pushed to: {event.repository.name}"
Here is the full example.
Bitbucket events supported
- repo:push
- pullrequest:created
- pullrequest:updated
- pullrequest:approved
- pullrequest:unapproved
- pullrequest:fulfilled
- pullrequest:rejected
Links
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
bb-hooks-router-0.0.6.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for bb_hooks_router-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cfa598821e202f75da515cbfb497b862cd910663fd275c085762b4723e4672c |
|
MD5 | 1344d8defdf1b4e778ca8188d1f0889a |
|
BLAKE2b-256 | 58adeeb719a8009e7e49b671d149dc73ca8d8c4b627a8fa4f982e63f22d5885c |