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

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

Kailash Patra December 8, 2017

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.

1 answer

0 votes
edwin
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.
March 7, 2019

Hi @Kailash Patra ,

Another option to use is Stashy

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events