Bitbucket hook diffstat
Overview
Bitbucket push webhook handler to generate a list of files changed on a push.
It processes branch updates/branch creates events and extracts the file paths of the files whose content was changed in that event, including the removal or creation of the file itself.
In the case of a branch update event, it gets the changeset between the current HEAD of the branch and the previous HEAD of that branch.
In case the branch is created, it gets the changeset between the current HEAD of the branch and the HEAD of the main branch of the repository.
It uses Bitbucket diffstat, repositories, and branches APIs. It handles some basic retries on retyable HTTP response codes from BitBucket.
It aslo perform a basic validation by comparing the expected owner and repo details with the details recieved in the push event, but in addition one should take care of whitelisting Bitbucket public IPs on the server side to make that check efficient.
Usage
from bitbucket_hook_diffstat import process_bitbucket_push_events
result = process_bitbucket_push_events(
push_payload, repo_owner, repo_name, bitbucket_user, bitbucket_password
) # it might raise an Exception, please check `bitbucket_hook_diffstat/exceptions.py`
result # Is a dict of a zero or more branch names - strings to the set of one or many file pathnames - strings.
{'master': {'.gitignore'}}
push_payload is a Bitbucket repository push event
repo_owner and repo_name one can retrieve from the repository URL https://bitbucket.org/repo_owner/repo_name
bitbucket_password is an "app password" and bitbucket_user is available as "Username" in Bitbucket profile settings. This user should be authorized to do Repositories Read.
Metadata
Release files for bitbucket-hook-diffstat 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bitbucket-hook-diffstat-0.5.2.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bitbucket_hook_diffstat-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / bitbucket-hook-diffstat-0.5.2.tar.gz
| Download URL | bitbucket-hook-diffstat-0.5.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dcfb07d48c007a4cb88385ddc4313363001ae05d1ce905fb8aa301a2cef9260
|
|
BLAKE2b-256 checksum How to use checksums |
178b849e859a60076a37e7eb10f8a4a9dbe5b27f30b777e0b0bdc642e0786d0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/21.5.0
|
Release files / bitbucket_hook_diffstat-0.5.2-py3-none-any.whl
| Download URL | bitbucket_hook_diffstat-0.5.2-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa1eab58b1d4357aaf87152b391442ed9202bc53a21270d2dd1b29b6be002f3b
|
|
BLAKE2b-256 checksum How to use checksums |
e7687a755aa521b9c643d7f074cbb83e9d53239c5c3eaaeaeb1b29310136e124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/21.5.0
|