ERROR
Attempts to run a Python script and log in to Portal for ArcGIS fail, and return the following error:
Error: OSError: Tunnel connection failed: 407 Proxy Authorization Required
The following shows a sample code that may result in the error:
import arcgis con = arcgis.gis.GIS(url="https://TEST.maps.arcgis.com", username="user1") con.map()
There are two possible causes:
Use the following solutions to fix the issue:
Add the following ArcGIS Online domains to the allowed list:
Declare the proxy_port parameter
To enable the script to recognize the custom port, the proxy_port parameter must be declared and added to the full script. The following shows the sample code:
gis = GIS(proxy_host='127.0.0.1', proxy_port=8888)
gis = GIS(url="https://arcgis.com", username="user1", password="password1", proxy_host="<username>:<password>@<proxyname>”, proxy_port=8888, verify_cert=False)
Get help from ArcGIS experts
Download the Esri Support App