使用ESRI arcgis python api时发生SSL错误



对于我公司的项目,我需要使用ESRI arcgis python API来访问我们企业arcgis门户中的数据。在安装了arcgis库之后,我通过GIS((对连接进行了测试。代码如下

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

但它给了我一个错误,如下

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

即使我设置了verify_cert=False,错误仍然存在。此外,我试图提前在环境中设置代理

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

运气也不好。我的openssl版本是openssl 1.1.1k 2021年3月25日-如果有人能为我提供一些解决方案,我将不胜感激

在安装arcgis后,我们使用pip install urllib3==1.25.11将python virt env中的urlib3降级为1.25.11,从而克服了这个错误

然后使用外代理gis = GIS(the_url, verify_cert=False, proxy_host="our.proxy", proxy_port=port_num)连接

最新更新