pydrive:为什么突然出现此验证错误?

时间:2019-06-18 10:09:22

标签: python pydrive

我有一个python脚本,可使用pydrive从Google云端硬盘下载文件。这是代码的相关位:

def get_drive_object():
        gauth = GoogleAuth()
        gauth.LoadCredentialsFile("mycreds.txt")
        if gauth.credentials is None:
                # Authenticate if they're not there
                gauth.LocalWebserverAuth()
        elif gauth.access_token_expired:
                # Refresh them if expired
                gauth.Refresh()
        else:
                # Initialize the saved creds
                gauth.Authorize()
        # Save the current credentials to a file
        gauth.SaveCredentialsFile("mycreds.txt")
        # from http://stackoverflow.com/a/24542604/170243
        gauth.LocalWebserverAuth()
        return GoogleDrive(gauth)

上周它突然停止工作,并给出了以下错误:

quitman$python update.py 
Traceback (most recent call last):
  File "update.py", line 264, in <module>
    chapters = create_chapter_set(get_file_list(), home)
  File "update.py", line 131, in get_file_list
    drive = get_drive_object()
  File "update.py", line 105, in get_drive_object
    gauth.Authorize()
  File "/home/toomanycooks/env/PyDrive-1.0.1-py2.7.egg/pydrive/auth.py", line 422, in Authorize
    self.service = build('drive', 'v2', http=self.http)
  File "/home/toomanycooks/env/oauth2client-1.4.9-py2.7.egg/oauth2client/util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/toomanycooks/env/google_api_python_client-1.4.0-py2.7.egg/googleapiclient/discovery.py", line 196, in build
    resp, content = http.request(requested_url)
  File "/home/toomanycooks/env/oauth2client-1.4.9-py2.7.egg/oauth2client/util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/toomanycooks/env/oauth2client-1.4.9-py2.7.egg/oauth2client/client.py", line 563, in new_request
    redirections, connection_type)
  File "/home/toomanycooks/env/httplib2-0.9.1-py2.7.egg/httplib2/__init__.py", line 1608, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/home/toomanycooks/env/httplib2-0.9.1-py2.7.egg/httplib2/__init__.py", line 1350, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/home/toomanycooks/env/httplib2-0.9.1-py2.7.egg/httplib2/__init__.py", line 1272, in _conn_request
    conn.connect()
  File "/home/toomanycooks/env/httplib2-0.9.1-py2.7.egg/httplib2/__init__.py", line 1059, in connect
    raise SSLHandshakeError(e)
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
quitman$vim update.py 

我很困惑。我曾尝试生成一个新的mycreds.txt文件,但对于这个错误是如何突然出现在作为cron作业已经运行了多年的代码上的,我还是感到困惑。

编辑:如果我将整个文件夹从服务器(dreamhost)下载到我的本地计算机,则代码运行良好...:s

0 个答案:

没有答案