Coverage for src/driada/gdrive/auth.py: 0.00%

13 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2025-07-25 15:40 +0300

1from pydrive2.auth import GoogleAuth 

2 

3 

4def desktop_auth(secret_path): 

5 gauth = GoogleAuth() 

6 GoogleAuth.DEFAULT_SETTINGS['client_config_file'] = secret_path 

7 # Create local webserver and auto handles authentication. 

8 gauth.LocalWebserverAuth() 

9 return gauth 

10 

11 

12def google_colab_auth(): 

13 from google.colab import auth 

14 from oauth2client.client import GoogleCredentials 

15 auth.authenticate_user() 

16 gauth = GoogleAuth() 

17 gauth.credentials = GoogleCredentials.get_application_default() 

18 return gauth