0

I want to ask if I can use Pydrive without having secret_client.json in my directory. I'm using py2exe on a file that uses pydrive and it can't include the json file also. How can I combine the json and the python file together so that the py2exe would work?

4

1 回答 1

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"}

Obs:当您设置时'client_config_backend': 'settings'gauth.DEFAULT_SETTINGS您说您将进入设置。有关这些设置的更多信息,请参阅pydrive

于 2017-02-21T17:06:27.080 回答