Dear All,
I am looking for to perform pushing and pulling code with Bitbucket using APIs ways(Python or Rest) urgently.
I found out
https://atlassian-python-api.readthedocs.io/bitbucket.html#manage-code
but here is latest news
https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231
Below is my draft Rest and Python Code
----------
import requests
auth = HTTPBasicAuth("user email", "app password")
headers = {
"Accept": "application/json"
}
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
print(response.text)
----------
# Get pull requests
bitbucket.get_pull_requests(project, repository, state='OPEN', order='newest', limit=100, start=0)
# Get pull request activities
bitbucket.get_pull_requests_activities(project, repository, pull_request_id)
# Get pull request changes
bitbucket.get_pull_requests_changes(project, repository, pull_request_id)
# Get pull request commits
bitbucket.get_pull_requests_commits(project, repository, pull_request_id)
# Add comment into pull request
bitbucket.add_pull_request_comment(project, repository, pull_request_id, text)
# Create a new pull request between two branches.
bitbucket.open_pull_request(source_project, source_repo, dest_project, dest_repo, source_branch, destination_branch, title, description)
# Create a new pull request between two branches with one reviewer
bitbucket.open_pull_request(source_project, source_repo, dest_project, dest_repo, source_branch, destination_branch, title, description, reviewers='name')
# Create a new pull request between two branches with multiple reviewers.
bitbucket.open_pull_request(source_project, source_repo, dest_project, dest_repo, source_branch, destination_branch, title, description, reviewers=['name1', 'name2'])
# Delete a pull request
bitbucket.delete_pull_request(project, repository, pull_request_id, pull_request_version)
# Get tags for related repo
bitbucket.get_tags(project, repository, filter='', limit=99999)
# Get project tags
# The authenticated user must have REPO_READ permission for the context repository to call this resource
bitbucket.get_project_tags(project, repository, tag_name)
# Set tag
# The authenticated user must have REPO_WRITE permission for the context repository to call this resource
bitbucket.set_tag(project, repository, tag_name, commit_revision, description=None)
# Delete tag
# The authenticated user must have REPO_WRITE permission for the context repository to call this resource
bitbucket.delete_tag(project, repository, tag_name)
# Get diff
bitbucket.get_diff(project, repository, path, hash_oldest, hash_newest)
# Get commit list from repo
bitbucket.get_commits(project, repository, hash_oldest, hash_newest, limit=99999)
# Get change log between 2 refs
bitbucket.get_changelog(project, repository, ref_from, ref_to, limit=99999)
# Get raw content of the file from repo
bitbucket.get_content_of_file(project, repository, filename, at=None, markup=None)
"""
Retrieve the raw content for a file path at a specified revision.
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
"""----------
I hope some one will advise me quickly and correctly with a working sample(code snippets) steps due to my rushing POC.
Really appreciate your kind help and time.
Best regards