SSL Wrong Version error

4490
18
Jump to solution
05-17-2021 11:20 AM
dgiersz_cuyahoga
Occasional Contributor

We have a proxy for all our web traffic and use the proxy_host/proxy_port parameters when connecting to AGOL from Notebooks in Pro. This worked fine until we upgraded to Pro 2.8 and we now receive SSL errors:

---------------------------------------------------------------------------
SSLError                                  Traceback (most recent call last)
In  [3]:
Line 1:     gis = GIS(proxy_host='XXX.XXXXXXXX.XX', proxy_port=XXXX, verify_cert=False)

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\__init__.py, in __init__:
Line 359:   raise e

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\__init__.py, in __init__:
Line 343:   trust_env=kwargs.get("trust_env", None))

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_portalpy.py, in __init__:
Line 173:   self.get_properties(True)

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_portalpy.py, in get_properties:
Line 1138:  raise e

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_portalpy.py, in get_properties:
Line 1126:  resp = self.con.post(path, self._postdata(), ssl=True)

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py, in post:
Line 690:   "Please set verify_cert=False due to encountered SSL error: %s" % err)

SSLError: Please set verify_cert=False due to encountered SSL error: HTTPSConnectionPool(host='www.arcgis.com', port=443): Max retries exceeded with url: /sharing/rest/portals/self (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1091)')))
---------------------------------------------------------------------------

The URLs for both HTTP and HTTPS traffic are the same for our proxy.

Has anyone else encountered this?

#CLE #sloth
18 Replies
GJY
by
New Contributor III

Long enough.  I've just been told by Esri Canada that the fix will show up in version 2.0.1 sometime in June/July.

0 Kudos
OrrGvili
New Contributor III

anyone found solution with the 2.9 ?  

we are still cant move from 2.7 

0 Kudos
dgiersz_cuyahoga
Occasional Contributor

I still have this issue with 2.9

#CLE #sloth
0 Kudos
BartGis5
New Contributor II

Hi,

I found a solution for arcgisPro 2.9.2. In my project we use the arcgis.gis.server.server() to make the new request see https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html. In there there is a parameter that is setting the difference between HTTPS and HTTP. Apperantly the default is True (or it needs to be explicitly mentioned to be false). In my case adding the parameter to false fixed the problem. It would be better of course to use the HTTPS.

BartStaats5_1-1651840848657.png

The real root cause is the update of the Urllib3 python library.  In v1.25.x HTTPS was not supported and every hTTPS call you did was transformed to HTTP. But in v1.26.x  is is supported and you should update your calls. I suppose Arcgis Pro 2.7 has the 1.125 version and the 2.8/9 had the 1.26 version but I haven't checket that.  https://github.com/urllib3/urllib3/issues/1850.

BartStaats5_2-1651841040599.png

 

 

GJY
by
New Contributor III

Thank you for this @BartGis5, helped me to fix a critical script for my org!

0 Kudos
OrrGvili
New Contributor III

with version 2.0.1 of the api
this method of using the proxy is the only one that working

# 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)

 we can move to arcgis pro 3 

AdminWPZ
New Contributor III

Did you test it with ArcGIS Pro 3? Anyone?

0 Kudos
OrrGvili
New Contributor III

yes the problem solved with api 2.0.1 that came with ArcGIS Pro 3 
we updated to pro and problem solved 

AdminWPZ
New Contributor III

Ah, thanks for clarifying, I misunderstood. And thanks for posting the solution!

0 Kudos