-
-
Save Oneiroi/b51c05f112cc234c938a486365193f21 to your computer and use it in GitHub Desktop.
Revisions
-
ustayready revised this gist
Nov 1, 2017 . No changes.There are no files selected for viewing
-
ustayready revised this gist
Nov 1, 2017 . No changes.There are no files selected for viewing
-
ustayready created this gist
Nov 1, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/usr/bin/env python import os from oauth2client import client, tools from oauth2client.file import Storage SCOPES = 'https://www.googleapis.com/auth/calendar https://mail.google.com/ https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/groups https://www.googleapis.com/auth/admin.directory.user' def get_credentials(): credential_dir =os.getcwd() client_secret_path = os.path.join(credential_dir, 'client_secrets.json') saved_secret_path = os.path.join(credential_dir, 'saved_creds.json') store = Storage(saved_secret_path) credentials = store.get() if not credentials or credentials.invalid: flow = client.flow_from_clientsecrets(client_secret_path, SCOPES, redirect_uri='http://localhost') url = flow.step1_get_authorize_url() flags = tools.argparser.parse_args(args=[]) flags.noauth_local_webserver = True credentials = tools.run_flow(flow, store, flags=flags) return credentials if __name__ == "__main__": get_credentials()