def new_credentials():
"""Perform OAuth2 flow to obtain the new credentials.
Return:
Credentials, the obtained credential.
"""
credential_path = os.path.join(args.creds_dir, 'ct_gdrive_creds.json')
store = oauth2client.file.Storage(credential_path)
credentials = store.get()
if not credentials or credentials.invalid:
flow = client.flow_from_clientsecrets(args.client_secret, SCOPES)
flow.user_agent = APPLICATION_NAME
credentials = tools.run_flow(flow, store, args)
print('Storing credentials to ' + credential_path)
return credentials
评论列表
文章目录