BitBucket access using python gives error Failed to establish a new connection: [WinError 10060] Edited

I am trying to access BitBucket repository using bitbucket-api in python. I am able to run below code successfully.

>>> from bitbucket.bitbucket import Bitbucket
>>> bb = Bitbucket(USERNAME, PASSWORD, 'private_slug')

But When I run below command getting error.

>>> success, result = bb.repository.get()Traceback (most recent call last):
File "D:\Program Files\lib\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "D:\Program Files\lib\urllib3\util\connection.py", line 83, in create_connection
raise err
File "D:\Program Files\lib\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Program Files\lib\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "D:\Program Files\lib\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "D:\Program Files\lib\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "D:\Program Files\lib\urllib3\connection.py", line 284, in connect
conn = self._new_conn()
File "D:\Program Files\lib\urllib3\connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x00000000044A0438>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Program Files\lib\requests\adapters.py", line 440, in send
timeout=timeout
File "D:\Program Files\lib\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:\Program Files\lib\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='bitbucket.org', port=443): Max retries exceeded with url: /api/1.0/user/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000044A0438>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
r = requests.get(url, auth=('username', 'password'), headers=headers)
File "D:\Program Files\lib\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "D:\Program Files\lib\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "D:\Program Files\lib\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "D:\Program Files\lib\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "D:\Program Files\lib\requests\adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='bitbucket.org', port=443): Max retries exceeded with url: /api/1.0/user/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000044A0438>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))

I have checked proxy setting as well. Any help would be greatly appreciated.

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

217 views 3 7
Read article

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