使用没有secret_client.json的Pydrive

时间:2016-02-20 20:02:00

标签: python py2exe pydrive

我想问一下,如果我的目录中没有secret_client.json,我是否可以使用Pydrive。 我在使用pydrive的文件上使用py2exe,它也不能包含json文件。 如何将json和python文件组合在一起以便py2exe可以工作?

1 个答案:

答案 0 :(得分:0)

我想要同样的事情,这对我有用:

gauth = GoogleAuth()
gauth.DEFAULT_SETTINGS = {'save_credentials': True,'client_config_backend': 'settings',
                          'oauth_scope': ['https://www.googleapis.com/auth/drive'], 
                          'get_refresh_token': True, 
                          'save_credentials_file':"credential_log.txt",
                          'save_credentials_backend': 'file'}

gauth.client_config = {'client_id': your_client_id, 'client_secret': your_client_secret,
                       'redirect_uri':'urn:ietf:wg:oauth:2.0:oob','revoke_uri': 'None',
                       'token_uri':'https://accounts.google.com/o/oauth2/token', 
                       'auth_uri':'https://accounts.google.com/o/oauth2/auth',
                       'save_credentials_file':"mycreds_p2iman.txt"}

观测值: 当您在'client_config_backend': 'settings'中设置gauth.DEFAULT_SETTINGS时,您说您将输入设置。有关这些设置的详细信息,请参阅pydrive