ArcGIS Python api SSL error

10286
5
Jump to solution
07-11-2021 11:44 PM
Mumulin96
Emerging Contributor

For my company's project, i need to use ESRI arcgis python API to access the data in our Enterprise ArcGIS portal. After installing the arcgis library, i did a test of the connection via GIS(). the code looks as below

gis = GIS( profile="link to the portal",username ="username",password="password",verify_cert = False ,proxy_host='username:password@proxy_host',proxy_port=proxy_port)

But it gives me an error as below

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

 The error still exists even though i set verify_cert = False Also i tried to set the proxy in the environment beforehand

os.environ['https_proxy'] = "http://proxy"

 No luck as well. my openssl version is OpenSSL 1.1.1k 25 Mar 2021- It's very appreciate if anyone could provide me some solutions

0 Kudos
1 Solution

Accepted Solutions
HamishMorton
Esri Contributor

Hi @Mumulin96, you mention you are connecting to your Enterprise Portal, but you omit the url argument and use profile instead. Is this intentional?

Does the following provide a different error message?

gis = GIS(url="link to the portal",
    username="username", 
    password="password", 
    verify_cert = False , 
    proxy_host='username:password@proxy_host', 
    proxy_port=proxy_port)

 

Hamish

View solution in original post

5 Replies
HamishMorton
Esri Contributor

Hi @Mumulin96, you mention you are connecting to your Enterprise Portal, but you omit the url argument and use profile instead. Is this intentional?

Does the following provide a different error message?

gis = GIS(url="link to the portal",
    username="username", 
    password="password", 
    verify_cert = False , 
    proxy_host='username:password@proxy_host', 
    proxy_port=proxy_port)

 

Hamish
Mumulin96
Emerging Contributor

I tried to change but the error still be the same.

even though i tried this

gis = GIS( verify_cert = False ,proxy_host='username:password@proxy_host',proxy_port=proxy_port  

 

0 Kudos
Mumulin96
Emerging Contributor

It works after i delete the proxy setting. the code looks as below.

 

gis = GIS( url="link to the portal",username ="username",password="password",verify_cert = False )

Many thanks. It saves my day!

Yogesh_Chavan
Frequent Contributor

Perfect thanks.

 

0 Kudos
anonymous55
Frequent Contributor

Hello,

I am getting this error with your code

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

any suggestions?

0 Kudos