Python 2.7 HTTPException:url的SSL证书无效和/或丢失:https://accounts.google.com/o/oauth2/token

Python 2.7 HTTPException:url的SSL证书无效和/或丢失:https://accounts.google.com/o/oauth2/token,python-2.7,google-app-engine,ssl,httpexception,google-earth-engine,Python 2.7,Google App Engine,Ssl,Httpexception,Google Earth Engine,当我通过Google AppEngine调用Google Earth Engine(GEE)Python API时,它抛出了一个HTTPException,上面写着“HTTPException:url的SSL证书无效和/或丢失:”。该项目在新年假期前运行良好,但当我昨天测试它时,它突然爆发,我自己的代码没有任何变化 我在使用App Engine的python脚本中也遇到了同样的问题。 几天前运行良好,accounts.google.com证书有效期至2017年3月9日 File "/Users/

当我通过Google AppEngine调用Google Earth Engine(GEE)Python API时,它抛出了一个HTTPException,上面写着“HTTPException:url的SSL证书无效和/或丢失:”。该项目在新年假期前运行良好,但当我昨天测试它时,它突然爆发,我自己的代码没有任何变化


我在使用App Engine的python脚本中也遇到了同样的问题。 几天前运行良好,accounts.google.com证书有效期至2017年3月9日

File "/Users/QQQ/Documents/Developpements/ae-python-project/app/user_spreadsheet_auth.py", line 55, in _get_service
  service = build('sheets', 'v4', http=http_auth)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/oauth2client/_helpers.py", line 133, in positional_wrapper
  return wrapped(*args, **kwargs)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/googleapiclient/discovery.py", line 222, in build
  cache)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/googleapiclient/discovery.py", line 269, in _retrieve_discovery_doc
  resp, content = http.request(actual_url)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/oauth2client/transport.py", line 159, in new_request
  credentials._refresh(orig_request_method)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/oauth2client/client.py", line 744, in _refresh
  self._do_refresh_request(http)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/oauth2client/client.py", line 775, in _do_refresh_request
  body=body, headers=headers)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/oauth2client/transport.py", line 282, in request
  connection_type=connection_type)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/httplib2/__init__.py", line 1609, in request
  (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/httplib2/__init__.py", line 1351, in _request
  (response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/Users/QQQ/Documents/Developpements/ae-python-project/libs/httplib2/__init__.py", line 1307, in _conn_request
  response = conn.getresponse()
File "/Users/QQQ/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/gae_override/httplib.py", line 532, in getresponse
  raise HTTPException(str(e))
HTTPException: Invalid and/or missing SSL certificate for URL: https://accounts.google.com/o/oauth2/token
编辑:看起来问题几小时前已经在这里报告了:

在上,维护人员给出了一个解决方法:

作为临时解决办法,您可以将过期的urlfetch_cacerts.txt替换为

在linux上,可以使用以下命令: wget-O{pythonsdk的Root}/lib/cacerts/urlfetch_cacerts.txt


对于Windows,因为SDK存储在管理员只读区域中,所以我分两步使用Windows文件资源管理器,而不是脚本

首先下载到文件夹,例如下载

curl https://curl.haxx.se/ca/cacert.pem > urlfetch_cacerts.txt
您还可以使用浏览器下载文件并对其重命名

检查您的磁带存放的位置。我在一个房间里找到的

C:\Program Files (x86)\Google\google_appengine\lib\cacerts
其他信息包括:

使用管理员凭据,将文件urlfetch_cacerts.txt重命名为其他文件

然后将下载的文件cacerts.pem复制到

C:\Program Files (x86)\Google\google_appengine\lib\cacerts
并将其重命名为urlfetch_cacerts.txt


作为一种快速解决方法,您可以重命名\u cacerts.txt中的cacerts.txt和urlfetch\u cacerts.txt以及文件夹google cloud sdk/platform/google\u appengine/lib/cacerts/中的\u urlfetch\u cacerts.txt,然后重新启动您的开发服务器。该错误已报告给谷歌,您可以在此处查看其状态:
C:\Program Files (x86)\Google\google_appengine\lib\cacerts