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(
'GET',
'courses/{}/quizzes/{}/statistics'.format(self.course_id, self.id),
_kwargs=combine_kwargs(**kwargs)
)
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
@python_2_unicode_compatible
class QuizStatistics(CanvasObject):
def __str__(self):
return "{} ({})".format(self.url, self.id)