KNOWLEDGE BASE

Error "Cannot connect to proxy" occurred when signing to local Tableau Server with REST API via Proxy


Published: 26 Sep 2022
Last Modified Date: 26 Sep 2022

Issue

When using REST API in python on a Tableau Server machine to sign in, the following error is encountered and the script fails if the proxy server is used in Tableau Server:

Max retries exceeded with url: /api/3.14/auth/signin (Caused by ProxyError('Cannot connect to proxy.'...

Environment

  • Tableau Server
  • Tableau REST API
  • Windows 10
  • Proxy
  • Python 3.9.x( and earlier) with requests(urllib3) package

Resolution

Option 1

Use python 3.10.5 instead of 3.9.x.

Option 2

Add NO_PORXY setting like below into the python script. This way will limit the NO_PORXY setting impact only into the python script itself. There is no need to restart the OS and no need to change the system level proxy setting.
=====
import os
os.environ['NO_PROXY'] = "localhost;127.0.0.1;<sever name>;<server ip address>"
=====


Option 3

Add the environmental variable NO_PROXY to bypass the proxy server for the localhost on Tableau Server.
  1. Click the search (magnifying glass) icon on the Windows menu.
  2. Enter sysdm.cpl to the text box and click the icon.
  3. Open the Advanced tab and click Environmental Variables.
  4. In the system variables section, click New to add the following environmental variable.
           Variable: NO_PROXY
           Value: localhost;127.0.0.1;<sever name>;<server ip address>
  1. Click OK to close the window.
If the proxy setting is configured in "Internet Options", you may also need to exclude localhost Tableau Server there.
  1. Click the search (magnifying glass) icon on the Windows menu.
  2. Enter "Internet Options" to the text box and click the icon.
  3. Select Connections > LAN Settings > Advanced.
  4. In the Exceptions section,  add the following value.
           localhost;127.0.0.1;<sever name>;<server ip address>
  1. Click OK to close the window.

Cause

This issue might be due to python 3.9 which has some proxy related issue, which is not related to Tableau REST API.

Additional Information

https://github.com/psf/requests/issues/6139
https://docs.python.org/release/3.10.5/whatsnew/changelog.html#python-3-10-5-final
 
Did this article resolve the issue?