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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,020
Community Members
 
Community Events
176
Community Groups

Bitbucket Python API?

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 Rising Star Apr 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)

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

Nvm, found a way, thank you!

Like edwin likes this

Do we have Pull request with stashy  @edwin  @lpetrinsak 

edwin Rising Star Aug 26, 2019

Hi @Amman MS ,

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

Hi there @edwin @lpetrinsak  ! 

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

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

@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 Rising Star Dec 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")
 

Hi @edwin ! 

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

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

Atlassian Community Events