I am currently using oauth2client in my Python webapp in order to use Google's calendar API.
I copied oauth2client into the root folder of my directory, and followed instructions at https://developers.google.com/google-apps/calendar/instantiate. Which means my code looks like:
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)
The ID, secret key are all from my Google Cloud Console account, so they should be correct. I'm seeing the following error in my log:
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
I'm lost as to what to do next, some guidance regarding next steps would be greatly appreciated. Thanks!!