Simple library for interacting with the Bitbucket Cloud API
Project description
bitbucketpy
WIP Python package for interacting with Bitbucket Cloud's API.
Usage
You'll need three items:
- EMAIL: The email address used to interact with Bitbucket.
- PASSWORD: An API key used to authenticate with Bitbucket.
- API_ENDPOINT: ex https://api.bitbucket.org/2.0
Interact with the repository API
import bitbucket
api = bitbucket.API(WORKSPACE, EMAIL, PASSWORD)
repository = api.get_repository(REPOSITORY_NAME)
Get branches in repository
branches = repository.branches()
for branch in branches:
print(branch.name)
The latest commit on a branch
commit = next(branch.commits)
Find commits ahead of master
feature_branch = repository.branch('feature_branch_name')
commits = [
commit
for commit in feature_branch.commits({'exclude': 'master', 'pagelen': 100})
]
print(f"feature_branch_name is {len(commits)} commits ahead of master")
Find a tag in the repository
tag = repository.tag('1.0.0')
Find pipelines for a branch
pipelines = list(api.get_pipelines(
'REPO_SLUG',
{
'target.branch':'BRANCH_NAME',
'sort': '-created_on',
'pagelen':20}))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bitbucketpy-0.1.10.tar.gz
(22.0 kB
view hashes)
Built Distribution
Close
Hashes for bitbucketpy-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5cbe4b3426ee1419580d51e0fa887e51693f33f14dec766d6677e94fa16da14 |
|
MD5 | a111ac65a0a4a8d59f74b00f4646596a |
|
BLAKE2b-256 | 97d736fa2015d6ac5972e7446a4238c0b2789d3c40dfcedc882ece0ede54844e |