Skip to main content
 首页 » 编程设计

python之gsutil ssl.SSLError : [Errno 185090050]

2025年05月04日12lautakyan007

我试图让 gsutil 在我的机器上运行,但它总是失败并出现以下错误:

ssl.SSLError: [Errno 185090050] _ssl.c:358: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib 

关于其他 python 应用程序的此错误有很多帖子,其中解决方案涉及编辑源代码。如果源代码是问题所在,那么 gsutil 开发人员需要了解它,但他们不会宣传用户如何发布错误。

我可能在安装 gsutil 时犯了错误。也许我需要获得证书并进行设置?但我不知道该怎么做。

我确实设法通过在 .boto 文件中禁用服务器身份验证来解决这个问题。但是为了安全起见,我更愿意进行身份验证。

希望有人能帮我解决这个问题。

请您参考如下方法:

部分更新将解决问题

方法一 如果您使用 gsutil 源代码,那么

只更新httplib2包 https://github.com/httplib2/httplib2

或者

仅更新 httplib2 包内的证书 https://github.com/httplib2/httplib2/blob/master/python2/httplib2/cacerts.txt

方法二

指定系统证书到boto.xt文件 https://github.com/fout/fout/blob/master/review/google_snippet_status/templates/boto.xt

https_validate_certificates = True 
ca_certificates_file = /etc/ssl/certs/ca-bundle.crt 

引用:http://boto.cloudhackers.com/en/latest/boto_config_tut.html

**注意:** 就我而言: 如果我使用像“ca_certificates_file = system”这样的系统,它会给出一些套接字错误

    Caught socket error, retrying: [Errno 185090050] _ssl.c:330: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib 
Retrying request to url <https://www.googleapis.com/storage/v1/b/adx-rtb-freakout-vd/o?   projection=full&prettyPrint=True&versions=False&fields=prefixes%2CnextPageToken%2Citems%2Fname&prefix=snippet_status&maxResults=500&delimiter=%2F&alt=json> after  connection break. 
Caught socket error, retrying: [Errno 185090050] _ssl.c:330: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib 

正在重试对 url https://www.googleapis.com/storage/v1/b/adx-rtb-freakout-vd/o?projection=full&prettyPrint=True&versions=False&fields=prefixes%2CnextPageToken%2Citems%2Fname&prefix=snippet_status&maxResults=500&delimiter=%2F&alt=json 的请求连接中断后。

注意:最好使用最新的 gsutil 和 Python 2.7.X