以下の通りになります。serviceのインスタンスは生成済みとします。あとは特に特筆するところはないかと思います。
This file contains 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 characters
def getCourseList(): | |
# Google Classroom APIから授業リストを取得する処理 | |
global service #serviceのインスタンスは別で生成済みとします | |
# クラスルームの一覧(コース一覧)を取得 | |
results = service.courses().list(pageSize=10).execute() | |
courses = results.get('courses', []) | |
#出力の例 | |
# for course in courses: | |
# print(course['name'],course['id']) | |
return courses |