ConnectionError - Overcoming proxy to access ArcGIS Online via the ArcGIS API for Python

220
4
Jump to solution
2 weeks ago
Labels (1)
Clubdebambos
Occasional Contributor III

Hello all,

I remote into a machine and there is a proxy in use. I cannot access AGOL via the ArcGIS API for Python. 

I try:

 

from arcgis.gis import GIS

agol = GIS("home")
or
agol = GIS(url="", username="", password="")

 

but I consistently get the following error.

 

ConnectionError: A connection error has occurred: HTTPSConnectionPool(host='xxx.maps.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001B61ED92730>: 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'))

 

Note, I can access just fine without the proxy from my laptop, but I must complete work on the remote machine that has the proxy. So accessing AGOL is not the issue, it is overcoming the proxy.

 Any ideas?

Cheers,

~ learn.finaldraftmapping.com
0 Kudos
1 Solution

Accepted Solutions
EarlMedina
Esri Regular Contributor

Hey, have you tried using the proxy parameter? I've heard mixed reviews, but hopefully your proxy is more forgiving:

 

# Usage Exmaple 9: Using a Proxy
proxy = {
    'http': 'http://10.10.1.10:3128',
    'https': 'http://10.10.1.10:1080',
}
gis = GIS(proxy=proxy)

 

View solution in original post

4 Replies
EarlMedina
Esri Regular Contributor

Hey, have you tried using the proxy parameter? I've heard mixed reviews, but hopefully your proxy is more forgiving:

 

# Usage Exmaple 9: Using a Proxy
proxy = {
    'http': 'http://10.10.1.10:3128',
    'https': 'http://10.10.1.10:1080',
}
gis = GIS(proxy=proxy)

 

Clubdebambos
Occasional Contributor III

Hi @EarlMedina 

Excellent, this approach worked. Here's what I was given, this failed to connect.

proxy = {
    "http" : "http://**.***.*.**:XXXX"
}

 This worked when I added the same information for the https key.

proxy = {
    "http" : "http://**.***.*.**:XXXX",
    "https" : "http://**.***.*.**:XXXX"
}

agol = GIS("home", proxy=proxy)

Thanks you!

~ learn.finaldraftmapping.com
0 Kudos
jcarlson
MVP Esteemed Contributor

I recently had to downgrade the urllib3 package to get my ArcGIS Python API to work correctly. Did you update your Python env recently?

- Josh Carlson
Kendall County GIS
Clubdebambos
Occasional Contributor III

Hi @jcarlson 

It was not a recent upgrade, but thank you for your response. This is great to know and I will keep an eye out for this when upgrades happen. Earls solution above worked after testing dictionary configs.

~ learn.finaldraftmapping.com
0 Kudos