Metadata-Version: 2.1
Name: bitbucket-webhooks
Version: 0.0.7
Summary: Routes bitbucket webhook API event payloads to easily consumable decorators with payload serialized to python objects.
Home-page: https://github.com/mukund-murali/bitbucket-webhooks-router
Author: Mukund Muralikrishnan
Author-email: mukund.muralikrishnan@gmail.com
License: UNKNOWN
Project-URL: Bug Reports, https://github.com/mukund-murali/bitbucket-webhooks-router/issues
Project-URL: Source, https://github.com/mukund-murali/bitbucket-webhooks-router
Keywords: bitbucket webhooks development
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.5
Description-Content-Type: text/markdown
Requires-Dist: marshmallow-objects (>=2.2.2)
Requires-Dist: marshmallow (>=3.0.0)
Provides-Extra: dev
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'

# bitbucket-webhooks-router

[![Build Status](https://travis-ci.com/mukund-murali/bitbucket-webhooks-router.svg?branch=master)](https://travis-ci.com/mukund-murali/bitbucket-webhooks-router)

Python library that makes webhook API [event payloads](https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html) available via decorators with payload serialized into python objects.


## Installation

```
$ pip install bb-hooks-router
```

## Quickstart

```python
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](https://github.com/mukund-murali/bitbucket-webhooks-router/tree/master/examples/sample_flask_app) is the full example.


## Bitbucket 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


## Links

[PyPI](https://pypi.org/project/bb-hooks-router/)


