How to use BitBucket Server API in Python Edited

I am new to BitBucket Server and I have a lot of problems now with playing around its API.

I have searched on Internet how to use BitBucket Server API in Python and some told me to use Stash. However, when I try this in Python, I keep get 503 Service Unavailable.

 

import stashy

stash = stashy.connect("http://localhost:7990/stash", "USERNAME", "PASSWORD")

stash.admin.groups.list()
Traceback (most recent call last):
File "/PATH/foo.py", line 5, in <module>
stash.admin.groups.list()
File "/PATH/miniconda3/lib/python3.6/site-packages/stashy/helpers.py", line 124, in list
return list(self.all(filter))
File "/PATH/miniconda3/lib/python3.6/site-packages/stashy/helpers.py", line 74, in paginate
maybe_throw(response)
File "/PATH/miniconda3/lib/python3.6/site-packages/stashy/errors.py", line 50, in maybe_throw
raise e
stashy.errors.GenericException: Unknown error: 503(Service Unavailable)

Does anyone have any ideas on what's happening here? Many thanks.

BTW, my ultimate goal is to issue comments on pull request in BitBucket Server using Python.

2 answers

1 accepted

0 vote

Hi Jekyll, looks like you're using Stashy, which is a Python API client for the Atlassian Stash REST API created by a third party.

In their documentation it says that Stashy supports Python 2.6, 2.7 and 3.3 but it seems like you're using Python 3.6, can you confirm this?

If you're already following the documentation at https://pypi.python.org/pypi/stashy/0.3 and using the supported versions and you still get errors, I'd recommend you to contact the author directly at https://github.com/cosmin

Hope that helps!

Ana

Oh, thank you so much. I can't believe I should overlook that.

No worries, glad I could help! Have a good day :)

Ana

When I tried stashy recently, it works well with Python 3.6. When I installed it via

pip install stashy

I got version 0.5 installed and it works.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Asked 12 hours ago in Confluence

What are the resources that you use to learn more about Atlassian Products?

I am gathering information about resources available for Atlassian product knowledge transferring for a presentation in our local Atlassian User Group. I want to group them in four categories From ...

61 views 3 4
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you