首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >SSL:使用Bigquery的CERTIFICATE_VERIFY_FAILED

SSL:使用Bigquery的CERTIFICATE_VERIFY_FAILED
EN

Stack Overflow用户
提问于 2017-06-19 21:58:04
回答 1查看 1.8K关注 0票数 0

我正在尝试在Python环境中查询Bigquery中的数据。

我使用服务帐户创建了我的凭据,方法是遵循Bigquery网站上的this step,并使用以下代码。

代码语言:javascript
运行
复制
from google.cloud import bigquery

client = bigquery.Client()
SQLCommand = '''
             Some sql command '''

query_results = client.run_sync_query(SQLCommand)
query_results.run()

但是,我遇到了以下错误,我不确定从哪里可以解决这个问题。任何建议都将不胜感激!

代码语言:javascript
运行
复制
Traceback (most recent call last):

File "<ipython-input-11-88c61e8cf342>", line 1, in <module>
  query_results.run()

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-    packages\google_cloud_bigquery-0.24.0-py2.7.egg\google\cloud\bigquery\query.py", line 364, in run
method='POST', path=path, data=self._build_resource())

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_cloud_core-0.24.1-py2.7.egg\google\cloud\_http.py", line 299, in api_request
headers=headers, target_object=_target_object)

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_cloud_core-0.24.1-py2.7.egg\google\cloud\_http.py", line 193, in _make_request
return self._do_request(method, url, headers, data, target_object)

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_cloud_core-0.24.1-py2.7.egg\google\cloud\_http.py", line 223, in _do_request
body=data)

File "build\bdist.win-amd64\egg\google_auth_httplib2.py", line 187, in request
self._request, method, uri, request_headers)

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_auth-1.0.1-py2.7.egg\google\auth\credentials.py", line 121, in before_request
self.refresh(request)

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_auth-1.0.1-py2.7.egg\google\oauth2\service_account.py", line 310, in refresh
request, self._token_uri, assertion)

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_auth-1.0.1-py2.7.egg\google\oauth2\_client.py", line 143, in jwt_grant
response_data = _token_endpoint_request(request, token_uri, body)

File "c:\users\xxxx\appdata\local\continuum\anaconda\lib\site-packages\google_auth-1.0.1-py2.7.egg\google\oauth2\_client.py", line 104, in _token_endpoint_request
method='POST', url=token_uri, headers=headers, body=body)

File "build\bdist.win-amd64\egg\google_auth_httplib2.py", line 119, in __call__
raise exceptions.TransportError(exc)

TransportError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
[1]: https://cloud.google.com/docs/authentication/getting-started
EN

回答 1

Stack Overflow用户

发布于 2017-06-27 05:42:05

我怀疑这不是特定于BigQuery的,这个问题的一个答案可能是相关的:

urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error

基本上,在默认情况下,根证书不会随某些版本的Python一起安装,您需要在安装后步骤中执行此操作。如果没有根证书,HTTPS客户端将无法检查远程服务器的身份。

简而言之,你可能需要这样做(取自链接的问题):

ReadMe将让您运行此安装后脚本,该脚本仅安装证书: /Applications/Python\ 3.6/Install\ Certificates.command

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44632600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档