I have followed Python Quick Start tutorial posted on https://developers.google.com/drive/v3/web/quickstart/python precisely and I am still getting the same error again and again (extremely frustrating):
File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 302, in new_from_json
module_name = data['_module']
KeyError: '_module'
It happens when client.py tries to process a secret-key.json file I downloaded from Google. Apparently client.py needs a _module dictionary key to be defined in json.
I've opened this secret-key.json file. Indeed there is a dictionary there but with no _module key in it (the content secret-key.json file is posted below).
Apparently I am missing something while following the Quick Start tutorial. What is it?
Below are the description of the main steps I followed while creating the secret-key.json file.
First I have added the credentials to my project:
From "Which API are you using" pull down menu I have selected the "Google Drive API" as my choice.
From "Where will you be calling the API from" pull-down menu below I have selected "Other UI (e.g. Windows, CLI tools)" (Interesting that these configuration settings are totally missed in Google Quick Start tutorial).
Lastly I have selected "User Data" radio button at the bottom of the page.
I wonder if the selection I have made on this page are correct? (since none of these selection choices are covered in the tutorial).
All other options and configurations I set exactly as it was described in Quick Start.
Here is the secret key secret-key.json file I downloaded:
{"installed":{
"client_id":"12345678-vasdfasdfasfd.apps.googleusercontent.com",
"project_id":"project-name",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"asdfasfdadf-asfasfdasdf",
"redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
To create this json file I went to Credentials tab and clicked the blue "Create Credentials" button which showed me the list of choices:
I have selected "OAuth client ID" and it brought me to the next page:
Here I have checked "Other" radio button and hit "Create" button. The json file is now became available for download.



Interesting that these configuration settings are totally missed in Google Quick Start tutorialno they aren't, in Step 1 the tutorial literally says "On the Add credentials to your project page, click the Cancel button."