def create_credentials():
scopes = ['https://www.googleapis.com/auth/admin.directory.resource.calendar',
'https://www.googleapis.com/auth/calendar']
client_secret_dict = ast.literal_eval(os.environ['MR_CLIENT_SECRET_JSON'])
credentials = ServiceAccountCredentials.from_json_keyfile_dict(
client_secret_dict, scopes=scopes).create_delegated(os.environ['MR_DELEGATED_ACCOUNT'])
http = credentials.authorize(Http())
directory = build('admin', 'directory_v1', http=http)
calendar = build('calendar', 'v3', http=http)
return directory, calendar
评论列表
文章目录