Routes bitbucket webhook API event payloads to consumable decorators with payload serialized to python objects.
Project description
bitbucket-webhooks
Python library that makes bitbucket webhook API event payloads available via decorators with payload serialized into python objects.
Installation
$ pip install bitbucket-webhooks
Quickstart
from flask import Flask
from flask import request
from bitbucket_webhooks import event_schemas
from bitbucket_webhooks import hooks
from bitbucket_webhooks import router
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.
Webhook events supported
- repo:push
- pullrequest:created
- pullrequest:updated
- pullrequest:approved
- pullrequest:unapproved
- pullrequest:fulfilled
- pullrequest:rejected
- pullrequest:comment_created
- pullrequest:comment_updated
- pullrequest:comment_deleted
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
Close
Hashes for bitbucket-webhooks-0.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a18180c2aecb78f318b17d069b72614b2902ec45943de81bbda0da0a427c3aa3 |
|
MD5 | 1869969f3343a9f4e5a1afe4375b23f1 |
|
BLAKE2b-256 | e18e56cc7ce8f48a74882ffad323a0df21e4d7e3e38a170d0c3ca182cc85f888 |
Close
Hashes for bitbucket_webhooks-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 374bad09181ff1f1e11b91442f698be5164ada00b50d19a6f479ded067f3e23f |
|
MD5 | 91913ce80c6e19c1d87ea4e939161d05 |
|
BLAKE2b-256 | 61e6da9b32f1f8fa3870342e9e78a595fabce7f5bb94cd1ca773a8d74abf257a |