Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Python API?

lpetrinsak April 29, 2019

I need a way to get a list of all repositories, via Python, that my account can access. Is there a way to do something like this?

2 answers

1 accepted

2 votes
Answer accepted
Edwin Kyalangalilwa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 29, 2019

Hi @lpetrinsak ,

You can use stashy

bitbucket = stashy.connect(host, user, password)

projects = bitbucket.projects.list()

for project in projects:
for repo in bitbucket.projects["%s" %(project["key"])].repos.list():
print(repo)
lpetrinsak April 29, 2019

Ah great! Thank you very much! Is it possible to acquire a list of "items" that are located in a particular repository?

lpetrinsak April 29, 2019

Nvm, found a way, thank you!

Like Edwin Kyalangalilwa likes this
Amman MS August 22, 2019

Do we have Pull request with stashy  @Edwin Kyalangalilwa  @lpetrinsak 

Edwin Kyalangalilwa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2019

Hi @Amman MS ,

Yes. You can see a full of whats implemented here: stashy 

Valeriy Yakovenko December 13, 2019

Hi there @Edwin Kyalangalilwa @lpetrinsak  ! 

I wanted to ask, is this stashy solution only for Bitbucket Server? Because i need to use same thing in Bitbucket Cloud

lpetrinsak December 13, 2019

I can only guess that same applies for Cloud...you can try it and see if it works though...

Valeriy Yakovenko December 13, 2019

@lpetrinsak thanks for fast reply! 

I already tried. And first problem, that stuck with is what URL(host in example above) should be for connection to API?  

Edwin Kyalangalilwa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2019

Hi @Valeriy Yakovenko  ,

Stashy is a client for Bitbucket Server.

The host above represents the Bitbucket base URL

bitbucket = stashy.connect("http://localhost:7990", "admin", "admin")

or

bitbucket = stashy.connect("http://localhost:7990/stash", "admin", "admin")
 
Valeriy Yakovenko December 25, 2019

Hi @Edwin Kyalangalilwa ! 

Thank you for your fast reply, and sorry for my late reply. 

I will be really happy if you can give some advise about what to use for BitBucket Cloud API in python?

Like # people like this
0 votes
Mark Arce
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 25, 2022

Open source and actively maintained as of Dec 2022: https://pypi.org/project/atlassian-python-api/ (note that this project is not maintained by Atlassian)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events