用于与 Bitbucket Cloud API 交互的简单库
项目描述
比特桶
用于与 Bitbucket Cloud 的 API 交互的 WIP Python 包。
用法
你需要三个项目:
- EMAIL:用于与 Bitbucket 交互的电子邮件地址。
- PASSWORD:用于向 Bitbucket 进行身份验证的 API 密钥。
- API_ENDPOINT:前https://api.bitbucket.org/2.0
与存储库 API交互
import bitbucket
api = bitbucket.API(WORKSPACE, EMAIL, PASSWORD)
repository = api.get_repository(REPOSITORY_NAME)
获取存储库中的分支
branches = repository.branches()
for branch in branches:
print(branch.name)
分支上的最新提交
commit = next(branch.commits)
在 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")
在存储库中查找标签
tag = repository.tag('1.0.0')
查找分支的管道
pipelines = list(api.get_pipelines(
'REPO_SLUG',
{
'target.branch':'BRANCH_NAME',
'sort': '-created_on',
'pagelen':20}))
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
bitbucketpy-0.1.12.tar.gz
(22.0 kB
查看哈希)
内置分布
bitbucketpy-0.1.12-py3-none-any.whl
(21.5 kB
查看哈希)