ArcGIS Python api SSL error

359
3
Jump to solution
07-11-2021 11:44 PM
Mumulin96
New Contributor II

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

0 Kudos
3 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

View solution in original post

0 Kudos
Mumulin96
New Contributor II

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
New Contributor II

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!