Community Novice

Getting list of Quiz Statistics

Hi all,

In my application, I'm making separate API calls for each Quiz object to get its Statistics.

And as a result of this, if the number of Quiz is large, sometimes it takes minutes to load the page.

Would there be a better way to achieve this without creating separate API calls for each Quiz to speed up the process?

FYI, I'm using python SDK to make requests.

Thank you!

Labels (1)
0 Kudos
1 Reply
Community Novice

I'm uploading the function that I created inside quiz.py that returns the statistics object:

# function declaration

def get_statistics(self, **kwargs):
   response = self._requester.request(
      'courses/{}/quizzes/{}/statistics'.format(self.course_id, self.id),
   response_json = response.json()
   response_json['quiz_statistics'][0]['course_id'] = self.course_id

   return QuizStatistics(self._requester, response_json['quiz_statistics'][0])

# QuizStatistics class declaration

class QuizStatistics(CanvasObject):
   def __str__(self):
   return "{} ({})".format(self.url, self.id)


0 Kudos