oauth2 error '_module' dict entry
See original GitHub issueHi,
I am trying to get the python quickstart.py to work described here: https://developers.google.com/drive/api/v3/quickstart/python
I also ran into #12, but additionally I am having issues loading the credentials.json that I downloaded when I enabled the Drive API per the link above.
It appears that the oauth2client module is attempting to extract a ‘_module’ entry, which doesn’t exist in the credentials.json file generated during the download.
I’ve been using python for a while, but this is the first time in a couple of years I’m playing with the google APIs. Not sure if this is something I’m doing wrong or if I stumbled on a bug.
ipython dump below. I confirmed that the data is a dict with the contents of the credentials.json file.
[edit: Note that I moved the credentials.json file into the same directory as the quickstart.py directory.]
Thanks,
- Josh.
(C:\Users\josh\Anaconda3\envs\py35) d:\somedir>ipython --pdb quickstart.py
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
d:\somedir\quickstart.py in <module>()
15 #store = file.Storage('PublishPdf.json')
16 store = file.Storage('credentials.json')
---> 17 creds = store.get()
18 if not creds or creds.invalid:
19 flow = client.flow_from_clientsecrets('client_secret.json', SCOPES)
C:\Users\josh\Anaconda3\envs\py35\lib\site-packages\oauth2client\client.py in get(self)
405 self.acquire_lock()
406 try:
--> 407 return self.locked_get()
408 finally:
409 self.release_lock()
C:\Users\josh\Anaconda3\envs\py35\lib\site-packages\oauth2client\file.py in locked_get(self)
52
53 try:
---> 54 credentials = client.Credentials.new_from_json(content)
55 credentials.set_store(self)
56 except ValueError:
C:\Users\josh\Anaconda3\envs\py35\lib\site-packages\oauth2client\client.py in new_from_json(cls, json_data)
300 # Find and call the right classmethod from_json() to restore
301 # the object.
--> 302 module_name = data['_module']
303 try:
304 module_obj = __import__(module_name)
KeyError: '_module'
> c:\users\josh\anaconda3\envs\py35\lib\site-packages\oauth2client\client.py(302)new_from_json()
300 # Find and call the right classmethod from_json() to restore
301 # the object.
--> 302 module_name = data['_module']
303 try:
304 module_obj = __import__(module_name)
ipdb>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:8
Same issue here
“I am having issues loading the credentials.json that I downloaded” As the tutorial says, you should rename that file that you downloaded to “client_secret.json”. “credentials.json” will be automatically created when you run the Python script for the first time. (agreed that this might be confusing)