Ошибка EOF с Google oauth2client (Python, google-app-engine)

В настоящее время я использую oauth2client в своем веб-приложении Python, чтобы использовать API календаря Google.

Я скопировал oauth2client в корневую папку своего каталога и следовал инструкциям на странице https://developers.google.com/google-apps/calendar/instantiate. Это означает, что мой код выглядит так:

import httplib2
import gflags

from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run

FLAGS = gflags.FLAGS

FLOW = OAuth2WebServerFlow(
client_id='myid',
client_secret='mycode',
scope='https://www.googleapis.com/auth/calendar',
user_agent='myapp/4')

storage = Storage('calendar.dat')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
    credentials = run(FLOW, storage)

Идентификатор и секретный ключ взяты из моей учетной записи Google Cloud Console, поэтому они должны быть правильными. Я вижу следующую ошибку в своем журнале:


ERROR    2013-12-10 14:03:33,983 api_server.py:112] Received a request without request_id: service_name: "remote_socket"
method: "Close"
request: "\n$730cd3cf-61cc-11e3-bf32-8434978873f1"

ERROR    2013-12-10 14:03:33,986 api_server.py:112] Received a request without request_id: service_name: "remote_socket"
method: "Close"
request: "\n$730e3361-61cc-11e3-9549-8434978873f1"

WARNING  2013-12-10 19:03:33,990 old_run.py:88] This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
Go to the following link in your browser:

    https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&client_id=208073911119-t7ianda543s99c2g1t581kgmqb04jngi.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&access_type=offline

Enter verification code: ERROR    2013-12-10 19:03:33,992 wsgi.py:219] 
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 196, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 255, in _LoadHandler
    handler = __import__(path[0])
  File "C:\Users\la\Documents\GitHub\StorageBox\boxitnowapp\main.py", line 63, in <module>
    credentials = run(FLOW, storage)
  File "C:\Users\la\Documents\GitHub\StorageBox\boxitnowapp\oauth2client\util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Users\la\Documents\GitHub\StorageBox\boxitnowapp\oauth2client\old_run.py", line 149, in run
    code = raw_input('Enter verification code: ').strip()
EOFError: EOF when reading a line

Я не знаю, что делать дальше, буду очень признателен за некоторые рекомендации относительно следующих шагов. Спасибо!!


person laurenzlong    schedule 10.12.2013    source источник