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?

P.Dowsen
  • 3
  • 3

1 Answers1

0

I wanted the same thing and this worked for me:

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: when you set 'client_config_backend': 'settings' in gauth.DEFAULT_SETTINGS you are saying you will enter the settings. For more information about these settings I refer to pydrive

Rafael
  • 433
  • 6
  • 12