1

我写了一个简单的代码,与https://developers.google.com/drive/quickstart-python上的代码基本相同,每次第一次尝试后我都会遇到同样的错误:

# Traceback (most recent call last):
#   File "C:/plug-ins/googleDrive.py", line 35, in <lambda>
#     self.authAction = self.menu.addAction( 'Authentication', lambda: self.runAuthentication()  )
#   File "C:/plug-ins/googleDrive.py", line 46, in runAuthentication
#     credentials = self.flow.step2_exchange( unicode(text) )
#   File "D:/Python\oauth2client\util.py", line 120, in positional_wrapper
#     return wrapped(*args, **kwargs)
#   File "D:/Python\oauth2client\client.py", line 1131, in step2_exchange
#     headers=headers)
#   File "D:/Python\httplib2\__init__.py", line 1597, in request
#     (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
#   File "D:/Python\httplib2\__init__.py", line 1345, in _request
#     (response, content) = self._conn_request(conn, request_uri, method, body, headers)
#   File "D:/Python\httplib2\__init__.py", line 1281, in _conn_request
#     conn.connect()
#   File "D:/Python\httplib2\__init__.py", line 1013, in connect
#     self.disable_ssl_certificate_validation, self.ca_certs)
#   File "D:/Python\httplib2\__init__.py", line 80, in _ssl_wrap_socket
#     cert_reqs=cert_reqs, ca_certs=ca_certs)
#   File "C:\python26\ssl.py", line 350, in wrap_socket
#   File "C:\python26\ssl.py", line 118, in __init__
#   File "C:\python26\ssl.py", line 293, in do_handshake
# ssl.SSLError: [Errno 8] _ssl.c:480: EOF occurred in violation of protocol

我在 Python 2.6.4、httplib2 v0.7.7 和 google-api-python-client v1.0b9 下运行它。如果有人有想法......我将非常感激。

4

1 回答 1

1

该版本的 google-api-python-client (v1.0b9) 是客户端库的 beta 9,您应该升级到发布版本,即 v1.0。

至于“EOF 违反协议”,我只看到发生在不稳定的网络连接上,是这种情况吗?

于 2012-11-22T03:17:16.533 回答