参考:https://pythonhosted.org/PyDrive/1 . https://pythonhosted.org/PyDrive/quickstart.html#authentication"client_secret创建。
from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
误差:InvalidClientSecretsError(最近一次调用最后一次)/opt/conda/lib/python3.6/site-packages/pydrive/auth.py in LoadClientConfigFile(self, client_config_file)385年试题:——比;386 client_type, client_info = clientsecrets.loadfile(client_config_file)387 . clientsecrets除外。InvalidClientSecretsError为错误:…/opt/conda/lib/python3.6/site-packages/pydrive**/auth.py** in LoadClientConfigFile(self, client_config_file)386 client_type, client_info = clientsecrets.loadfile(client_config_file)387 . clientsecrets除外。InvalidClientSecretsError为错误:——比;388引发InvalidConfigError('无效的客户端机密文件%s' ' %错误)389 if not client_type in (clientsecrets.)TYPE_WEB,390年 clientsecrets.TYPE_INSTALLED):
InvalidConfigError:无效的客户端机密文件缺少属性"redirect_uri "在客户端类型为"web">.
尝试
gauth = GoogleAuth()
credential_file = 'client_secrets.json'
gauth.LoadCredentialsFile(credential_file)
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
gauth.SaveCredentialsFile(credential_file)
误差KeyError回溯(最近的最后一次调用)在2 credential_file = 'client_secrets. file 'json ' # ' . ./输入/gdriveauth/client_secret_259511041847-no6nt8ennhbccaoqhv98ucsccv3hglu7.apps.googleusercontent.com.json '3 # gauth.LoadCredentialsFile (credential_file)——→4 gauth.LoadCredentialsFile (credential_file)…
/opt/conda/lib/python3.6/网站/oauth2client/client.py在new_from_json(cls, json_data)查找并调用正确的类方法from_json()来恢复301 #对象。——比;302 module_name = data['_module']303年试题:304 module_obj =import(module_name)
KeyError:"_module">
您创建并下载的凭证文件类型不正确。
当你在console.cloud.google.com上创建凭据时,你需要选择一个应用程序类型为"桌面"而不是"Web"。