def create_credentials(client_secret_path):
"""Gets valid user credentials from storage.
Args:
path (str), path to client_secret.json file
"""
flow = client.flow_from_clientsecrets(client_secret_path, ' '.join(SCOPES))
flow.user_agent = 'Clouseau'
flow.params['access_type'] = 'offline'
flow.params['approval_prompt'] = 'force'
store = oauth2client.file.Storage(CREDENTIALS_PATH)
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args(['--noauth_local_webserver'])
tools.run_flow(flow, store, flags)
评论列表
文章目录