Skip to main content

Routes bitbucket webhook API event payloads to consumable decorators with payload serialized to python objects.

Project description

bitbucket-webhooks

Build Status

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

bitbucket-webhooks-0.0.11.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

bitbucket_webhooks-0.0.11-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file bitbucket-webhooks-0.0.11.tar.gz.

File metadata

  • Download URL: bitbucket-webhooks-0.0.11.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for bitbucket-webhooks-0.0.11.tar.gz
Algorithm Hash digest
SHA256 a18180c2aecb78f318b17d069b72614b2902ec45943de81bbda0da0a427c3aa3
MD5 1869969f3343a9f4e5a1afe4375b23f1
BLAKE2b-256 e18e56cc7ce8f48a74882ffad323a0df21e4d7e3e38a170d0c3ca182cc85f888

See more details on using hashes here.

File details

Details for the file bitbucket_webhooks-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: bitbucket_webhooks-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for bitbucket_webhooks-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 374bad09181ff1f1e11b91442f698be5164ada00b50d19a6f479ded067f3e23f
MD5 91913ce80c6e19c1d87ea4e939161d05
BLAKE2b-256 61e6da9b32f1f8fa3870342e9e78a595fabce7f5bb94cd1ca773a8d74abf257a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page