bitbucket-python is an API wrapper for Bitbucket written in Python
Installing
pip install bitbucket-python
Usage
from bitbucket.client import Client
from bitbucket import AsyncClient
client = Client('EMAIL', 'PASSWORD')
# Or to specify owner URL to find repo own by other user
client = Client('EMAIL', 'PASSWORD', 'Owner')
# Async client
async with AsyncClient('EMAIL', 'PASSWORD') as client:
...
Methods
Get user information
response = client.get_user()
Get account privileges for repositories
response = client.get_privileges()
Get repositories
response = client.get_repositories()
Get repository
response = client.get_repository('REPOSITORY_SLUG')
Post repository
response = client.create_repository(data, params, repositoryName, teamName)
Get branches for repository
response = client.get_repository_branches('REPOSITORY_SLUG')
Get tags for repository
response = client.get_repository_tags('REPOSITORY_SLUG')
Get commits for a repository
response = client.get_repository_commits('REPOSITORY_SLUG')
Get components for repository
response = client.get_repository_components('REPOSITORY_SLUG')
Get milestones for repository
response = client.get_repository_milestones('REPOSITORY_SLUG')
Get versions for repository
response = client.get_repository_versions('REPOSITORY_SLUG')
Create issue
data = {..DATA..}
response = client.create_issue('REPOSITORY_SLUG', data)
Get all issues
response = client.get_issues('REPOSITORY_SLUG')
Get issue
response = client.get_issue('REPOSITORY_SLUG', 'ISSUE_ID')
Delete issue
response = client.delete_issue('REPOSITORY_SLUG', 'ISSUE_ID')
Webhooks
Create webhook
data = {
"description": "Webhook",
"url": "http://mywebsite.com",
"active": True,
"events": [
"repo:push",
"issue:created",
"issue:updated"
]
}
response = client.create_webhook('REPOSITORY_SLUG', data)
Get all webhooks
response = client.get_webhooks('REPOSITORY_SLUG')
Get webhook
response = client.get_webhook('REPOSITORY_SLUG', 'WEBHOOK_ID')
Delete webhook
response = client.delete_webhook('REPOSITORY_SLUG', 'WEBHOOK_ID')
Helper methods
all_pages
The all_pages method is a helper function that makes it easy to retrieve all items from an API methods that uses pagination (see https://developer.atlassian.com/cloud/bitbucket/rest/intro/#pagination).
client = Client()
items = list(client.all_pages(client.get_repositories))
Note that the all_pages method uses a generator to return the results.
Requirements
- requests
- httpx
Metadata
Release files for bitbucket-python 0.3.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 | Provenance | |
|---|---|---|---|---|
| bitbucket_python-0.3.2.tar.gz | 8.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bitbucket_python-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / bitbucket_python-0.3.2.tar.gz
| Download URL | bitbucket_python-0.3.2.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0da43cd63586165e3f7f8fb72be280c488ed37ede43f9f3d3e6f417abe99dfb0
|
|
BLAKE2b-256 checksum How to use checksums |
51f64734cb8171d7676ed13eb593a939baa380189ef21e6b7cb2d6698ace2642
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / bitbucket_python-0.3.2-py3-none-any.whl
| Download URL | bitbucket_python-0.3.2-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
337335db038bb8223d44b12af10da6f83baf9add721b33a4b2825a7e17ba9d32
|
|
BLAKE2b-256 checksum How to use checksums |
fefe7eb40603adf139420f94884137301937299ecc7c6a031ff17478409fdbd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for bitbucket-python 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.