Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Receiving Connection aborted, Connection timed out error

Open ayan1983 opened this issue 4 years ago • 0 comments

Hi ,

I am trying to test the module and using the following code from office365.runtime.auth.client_credential import ClientCredential from office365.sharepoint.client_context import ClientContext

client_id = "" client_secret = "****" site_url = "https://***********************/"

credentials = ClientCredential(client_id, client_secret) ctx = ClientContext(site_url).with_credentials(credentials) web = ctx.web ctx.load(web) ctx.execute_query()

The above script is getting hung and throwing the following error

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in validate_conn conn.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 411, in connect self.sock = ssl_wrap_socket( File "/usr/local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 428, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( File "/usr/local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 472, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/local/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/local/lib/python3.8/ssl.py", line 1040, in _create self.do_handshake() File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 531, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in validate_conn conn.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 411, in connect self.sock = ssl_wrap_socket( File "/usr/local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 428, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( File "/usr/local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 472, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/local/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/local/lib/python3.8/ssl.py", line 1040, in _create self.do_handshake() File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', TimeoutError(110, 'Connection timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/office365/runtime/auth/providers/acs_token_provider.py", line 40, in get_app_only_access_token realm = self._get_realm_from_target_url() File "/usr/local/lib/python3.8/site-packages/office365/runtime/auth/providers/acs_token_provider.py", line 73, in _get_realm_from_target_url response = requests.head(url=self.url, headers={'Authorization': 'Bearer'}) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 104, in head return request('head', url, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', TimeoutError(110, 'Connection timed out'))

During handling of the above exception, another exception occurred: Could you please help me in understanding what could be the issue ?

ayan1983 avatar Jun 23 '21 18:06 ayan1983