Skip to main content

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


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.12.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

bitbucketpy-0.1.12-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file bitbucketpy-0.1.12.tar.gz.

File metadata

  • Download URL: bitbucketpy-0.1.12.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for bitbucketpy-0.1.12.tar.gz
Algorithm Hash digest
SHA256 b807623c789591da11a65677eb63109fe52c22dd41c336e8640a1bf266cb2a4c
MD5 44926bb5bd9ef59db94e8a3f070d09c8
BLAKE2b-256 cbf347d08b3fe5cdc9c7cfa3b539112ff7f494db13e0cb0e1912f6e483035e0b

See more details on using hashes here.

File details

Details for the file bitbucketpy-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: bitbucketpy-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for bitbucketpy-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 ff3adec8da86293a1780aefeae36a05d0801b24427440d5368485faa28ef9c60
MD5 48a7499928ee782f09223e030cdf413a
BLAKE2b-256 6f8deb3d37c8ac5cb462a8b392005e5e310c4d7a7b4a6d87c4ee4f6c4990940b

See more details on using hashes here.

Supported by

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