Dear All,
I am exploring BitBucket Module of Python API with below URL.
https://atlassian-python-api.readthedocs.io/bitbucket.html
However, I am still can't find the right python packages to use "bitbucket"
# Project list bitbucket.project_list()
I am keen to work for the following methods
Since I am rushing for my experiment and I hope someone will advise me to move forward quickly.
Best regards
Hey @Kyaw Welcome to Atlassian Community
do this install from pip
pip install atlassian-python-api
and in code use this
from atlassian import Bitbucket
Link for same here https://atlassian-python-api.readthedocs.io/index.html
Hi Vishwas,
Thanks for your prompt reply and I used it below
# Project list bitbucket.project_list()
# Get single repository bitbucket.get_repo(project_key, repository_slug)
# Get repositories list from project bitbucket.repo_list(project_key, limit=25)
# Decline pull request bitbucket.decline_pull_request(project_key, repository, pr_id, pr_version)
# Object oriented: # Get the repository first r = cloud.workspaces.get(workspace).repositories.get(repository)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Kyaw
Check this link here https://github.com/atlassian-api/atlassian-python-api/blob/master/examples/bitbucket/bitbucket_cloud_oo.py
A sample example is mentioned there.
Let me know in case of any questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vishwas,
Thanks for your help and pls advise me where can I have this URL https://api.bitbucket.org.
Since I have only this https://bitbucket.org/mrkyawkyawoo/
Also could it be possible to experiment locally first like below
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Kyaw
You are in bitbucket cloud.
so the api url to be used is https://api.bitbucket.org
This part is authentication for server which doesn't work in your case
# Log-in with E-Mail / Username and regular password # or with Username and App password. # Get App password from https://bitbucket.org/account/settings/app-passwords/. # Log-in with E-Mail and App password not possible. # Username can be found here: https://bitbucket.org/account/settings/ from atlassian.bitbucket import Cloud bitbucket = Cloud( username=bitbucket_email, password=bitbucket_password, cloud=True) bitbucket_app_pw = Cloud( username=bitbucket_username, password=bitbucket_app_password, cloud=True)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vishwas
That mean I need to open and use developer account instead of local server.
If the developer account, then how should I do or is it free or payable service?
Is there any way to use local server's experiment first before Cloud for the above assessment(https://atlassian-python-api.readthedocs.io/bitbucket.html#) ?
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vishwas ,
This URL https://pypi.org/project/bitbucket-python/ is working with
client = Client(bitbucket_email, bitbucket_password)
However, it is not enough for my use case since I would like to do like this URL https://atlassian-python-api.readthedocs.io/bitbucket.html#
But, I didn't have the proper Python package to install and set the Configuration yet.
Really appreciate your kind help soon.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Kyaw
Firstly i would like to understand the hosting you are on, without that i can't suggest.
But in generic let me answer the queries you have.
That mean I need to open and use developer account instead of local server. --> there is no need to open developer account for this. If you are on bitbucket cloud https://bitbucket.org/ you can generate an app password and use it in the API query.
But I understand that you are in https://bitbucket.org/ this only as mentioned above https://bitbucket.org/mrkyawkyawoo/. So navigate here and create app password https://bitbucket.org/account/settings/app-passwords/
If the developer account, then how should I do or is it free or payable service? --> Bitbucket free plan is there, so no need to pay anything for developer account
Is there any way to use local server's experiment first before Cloud for the above assessment(https://atlassian-python-api.readthedocs.io/bitbucket.html#) ? ->
Yes, you may have to install a local server of bitbucket datacentre variant to try them out https://www.atlassian.com/software/bitbucket/download/data-center
KB on how to install https://confluence.atlassian.com/bitbucketserver/install-bitbucket-data-center-872139817.html
Lastly
But, I didn't have the proper Python package to install and set the Configuration yet. -> what type of package are you expecting ?
This pip library pip install atlassian-python-api should be enough for you to use the API mentioned here https://atlassian-python-api.readthedocs.io/bitbucket.html#
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vishwas .
Thanks for prompt and detailed info.
I will try again first these https://atlassian-python-api.readthedocs.io/bitbucket.html#
However, I am still not getting to use the object instance of bitbucket(initial configuration) as below
bitbucket.project_list()
bitbucket.get_repo(project_key, repository_slug)
# Delete an existing Code Insights report bitbucket.delete_code_insights_report(project_key, repository_slug, commit_hash, report_key)
# Decline pull request bitbucket.decline_pull_request(project_key, repository, pr_id, pr_version
# Object oriented: # Get the repository first r = cloud.workspaces.get(workspace).repositories.get(repository)
Really appreciate your kind and prompt response.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Kyaw
I get it now
Its this line for bitbucket cloud
from atlassian.bitbucket import Cloud
and this in case of server/dc
from atlassian import Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vishwas
Here is
from atlassian import Bitbucket
bitbucket.project_list()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't understand sir :( Really confused here. Are you on server or cloud ?
the part is bitbucket server
bitbucket = Bitbucket(username=user_name,password=pass_word)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good day @Vishwas
Sorry for my confused questions and I am using currently
https://bitbucket.org/mrkyawkyawoo/
bitbucket.project_list()
bitbucket.get_repo(project_key, repository_slug)
# Delete an existing Code Insights report bitbucket.delete_code_insights_report(project_key, repository_slug, commit_hash, report_key)
# Decline pull request bitbucket.decline_pull_request(project_key, repository, pr_id, pr_version
# Object oriented: # Get the repository first r = cloud.workspaces.get(workspace).repositories.get(repository)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Kyaw
Not a problem, we at community are here to suggest and guide on best possible way.
When using cloud API there is no need to use this package
from atlassian import Bitbucket
I have also not much expertise on this but can guide you on the basic to get you going.
You can send a Zoom or hangout invite.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm at IST time zone. That is +05:30 GMT. You can send me invite around 1:00 PM IST. Is that okay for you. I'm not sure which time zone you are in it could be late for you.
Or else you can send the invite in late evenings here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.