Python: Authentication Timeout on Remote Server

  • 15 July 2017
  • 1 reply

Wondering if anyone has had a similar problem. I can authenticate on a local desktop but can’t authenticate on a remote server. After a while I receive the following error:

2017-07-14 22:01:07,162 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fee4c200a20>: Failed to establish a new connection: [Errno 110] Connection timed out',)': /api/3.0//login?client_id=HERE&client_secret=HERE

After it hangs it errors out to the following:

token = unauthenticated_authApi.login(client_id=client_id, client_secret=client_secret)
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/apis/", line 67, in login
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/apis/", line 149, inlogin_with_http_info
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/", line 323, in call_api
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/", line 150, in __call_api
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/", line 368, in request
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/", line 248, in POST
File /lib/python3.5/site-packages/swagger_client-1.0.0-py3.5.egg/swagger_client/", line 155, in request
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 70, in request **urlopen_kw)
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 148, in request_encode_body return self.urlopen(method, url, **extra_kw)
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 321, in urlopen response = conn.urlopen(method, u.request_uri, **kw)
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 678, in urlopen
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 600, in urlopen chunked=chunked)
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 345, in _make_request self._validate_conn(conn)
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 844, in _validate_connconn.connect()
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 284, in connectconn = self._new_conn()
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/", line 141, in _new_conn (, self.port), self.timeout, **extra_kw)
File /lib/python3.5/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/util/", line 73, in create_connection sock.connect(sa)

1 reply

Userlevel 3

@cross it looks to me like an issue at the network layer, which is consistent with the code working on your local machine but not on a remote machine.

Here are a couple of things to check for the remote machine:

  1. Does the remote machine have any firewall rules for inbound or outbound traffic? For example, on an Amazon EC2 instance, you will have to explicitly open outbound traffic on port 9999 in the security group rules to open a connection to the Looker instance’s API.

    2… If you host your own Looker instance, make sure that the IP of your remote machine is whitelisted by the Looker instance’s firewall rules so that it will accept inbound connections on port 9999 coming from that IP.

  2. Is the remote machine on a different VPC than the Looker instance? You’ll need to check the rules for inbound and outbound traffic for the VPC that your remote machine is on. And if you host your own Looker instance, you will need to do the same for the machine that runs Looker.

That’s all I can think of, I’m sure there are other possible issues. A couple of other things to look for are the presence of load balancers and reverse proxies and the like between the remote machine and Looker.

Let me know if you have any other questions or need additional help, you’re most likely one firewall rule away from successfully connecting.