我需要使用来编写我的数据流作业。
据我所知,我不能使用pip install google-cloud-dataflow,因为Apache不会在Python3上工作,所以我一直在使用googleapiclient.discovery。但是,当我发出build()命令时,它会引用错误进行轰炸:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)
背景说明:
certifi,但没有爱/Applications/Python\ 3.6/Install\ Certificates.command,但在虚拟服务器中找不到.command。而且,我也不愿意沿着这条路走下去,因为这将使我的刺激部署成为一场噩梦。这是我的密码:
from oauth2client.client import GoogleCredentials
from googleapiclient.discovery import build
credentials = GoogleCredentials.get_application_default()
dataflow = build('dataflow', 'v1b3', credentials=credentials)结果:
回溯(最近一次调用):文件"test_dataflow_creds.py",第6行,在dataflow = build('dataflow','v1b3',credentials=credentials)文件positional_wrapper行130中,在positional_wrapper返回包装(*args)中**kwargs)文件"/Users/user/.pyenv/versions/unit-test-3.7/lib/python3.7/site-packages/googleapiclient/discovery.py",行222,在build requested_url,discovery_http,cache_discovery,cache中,_retrieve_discovery_doc resp中的文件"/Users/user/.pyenv/versions/unit-test-3.7/lib/python3.7/site-packages/googleapiclient/discovery.py",行269,"/Users/user/.pyenv/versions/unit-test-3.7/lib/python3.7/site-packages/httplib2/init.py",= http.request(actual_url)文件的第1924行,在_request conn、request_uri、method、body中,在请求缓存键中,在文件"/Users/user/.pyenv/versions/unit-test-3.7/lib/python3.7/site-packages/httplib2/init.py",行1595中,头文件"/Users/user/.pyenv/versions/unit-test-3.7/lib/python3.7/site-packages/httplib2/init.py",第1501行,在_conn_request conn.connect() File "/Users/user/.pyenv/versions/unit-test-3.7/lib/python3.7/site-packages/httplib2/init.py",第1291行中,在connect self.sock = self._context.wrap_socket(sock,文件"/Users/user/.pyenv/versions/3.7.0/lib/python3.7/ssl.py",第412行,wrap_socket session=session文件"/Users/user/.pyenv/versions/3.7.0/lib/python3.7/ssl.py",行850,_create self.do_handshake() "/Users/user/.pyenv/versions/3.7.0/lib/python3.7/ssl.py",第1108行,在do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: SSL: CERTIFICATE_VERIFY_FAILED证书验证失败:无法获得本地颁发者证书(_ssl.c:1045)
发布于 2019-01-29 23:32:15
tl;dr:通过将所有Certs导出到一个公共文件,然后按照Certifi指定的路径追加到Cert文件,使其工作正常。
步骤:
https://stackoverflow.com/questions/54283148
复制相似问题