Search code examples
pythonpython-3.xgoogle-classroom

Google Classroom Python make return course materials aswell


Ok so basically, I'm trying to get all the course work there are for a course. But i only get in response the coursework that are not of type 'MATERIAL'. How can I do so that I get the coursework type 'MATERIAL' aswell?

Here is my python code:

resultcourses = service.courses().list().execute()
courses = resultcourses.get('courses', [])

for course in courses:
    resultscourseworks = service.courses().courseWork().list(courseWorkStates='PUBLISHED', 
    courseId=course['id']).execute()
    courseworks = courseworks + resultscourseworks.get('courseWork', [])```

Solution

  • Currently it is not possible to get the Material coursework as mentioned on the first paragraph of the Manage Classwork guide:

    Classroom has five types of Classwork: Assignments, Quiz Assignments, Questions (short answer and multiple choice), Materials, and Topics. The Classroom API currently allows developers to read and write two of these types: Assignments and Questions.