It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

bitbucket proxy setting python

Hi,

 

Because I want to make every computer which has different proxy setting(or none setting) can run my program, I would like to know how to set proxy in my python program. Or it will produce error: HTTPSConnectionPool(host='git.XXXX.com', port=443): Max retries exceeded with url: /rest/api/1.0/projects/xxx/repos/ooo/tags?limit=1000 (Caused by ProtocolError('Connection aborted.', error(10054, 'An existing connection was forcibly closed by the remote host'))) 

I think this error is caused by proxy because after I set proxy on some computer, it works.

I use Bitbucket Server and atlassian-python-api module.

My program is as following:

--------------------------------------------------------------------------------------------

from atlassian import Bitbucket

...

bbucket = Bitbucket(url='https://git.XXXX.com', username=username, password=password)

tag = bbucket.get_tags('xxx', 'ooo')

...

--------------------------------------------------------------------------------------------

Is there any methods or other ways can help me? Something like: bitbucket.proxies = {'http':proxy_setting, 'https':proxy_setting}? or command setting?

 

Thanks a lot.

1 answer

1 accepted

0 votes
Answer accepted

Sorry, I found it. Done.

how do you do it?

Hi,

 

proxy_setting = http://<username>:<password>@proxy:<portNumber>
bbucket = Bitbucket(url='https://...', username=username, password=password)
bbucket._session.proxies = {'http': proxy_setting, 'https': proxy_setting}

I set it like this and it works. :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

Share your software development horror stories!

Hey Community! I work on the Bitbucket product marketing team. With Halloween approaching, we wanted to discuss a topic tailor-made for October: development horror stories. Whether it was a lurk...

1,578 views 11 3
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you