From d312ed5ce41f2d0b05674a6b83c2a50e8a7a118c Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Sun, 10 Feb 2019 16:13:48 -0500 Subject: [PATCH 1/2] Create alt_credential_auth.py --- examples/alt_credential_auth.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 examples/alt_credential_auth.py diff --git a/examples/alt_credential_auth.py b/examples/alt_credential_auth.py new file mode 100644 index 0000000..2eecc50 --- /dev/null +++ b/examples/alt_credential_auth.py @@ -0,0 +1,13 @@ +from oauth2client.service_account import ServiceAccountCredentials +from pydrive.auth import GoogleAuth +from pydrive.drive import GoogleDrive + +GOOGLE_SCOPES = ['https://www.googleapis.com/auth/drive'] +creds = ServiceAccountCredentials.from_json_keyfile_name('service-key.json, GOOGLE_SCOPES) + +gauth = GoogleAuth() +gauth.credentials = creds + +drive = GoogleDrive(gauth) + +# Now do stuff as normal! From cd6556dc0bf3d02732338d5598dee11c44c2dd69 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Fri, 7 May 2021 11:51:52 -0400 Subject: [PATCH 2/2] Update examples/alt_credential_auth.py --- examples/alt_credential_auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/alt_credential_auth.py b/examples/alt_credential_auth.py index 2eecc50..961c84b 100644 --- a/examples/alt_credential_auth.py +++ b/examples/alt_credential_auth.py @@ -3,7 +3,7 @@ from pydrive.drive import GoogleDrive GOOGLE_SCOPES = ['https://www.googleapis.com/auth/drive'] -creds = ServiceAccountCredentials.from_json_keyfile_name('service-key.json, GOOGLE_SCOPES) +creds = ServiceAccountCredentials.from_json_keyfile_name('service-key.json', GOOGLE_SCOPES) gauth = GoogleAuth() gauth.credentials = creds