course_id = 666666
course = canvas.get_course(course_id)
logged_events = course.query_audit_by_course()
event_list = [e for e in logged_events]
fails with AttributeError: 'str' object has no attribute 'update' because (I believe) the API has been changed to return a JSON object with three-keys, the basic structure is:
{
"links": {},
"events": [],
"linked": {}
}
with the second key containing what used to be returned by the API (a list of CourseEvent objects)
To Reproduce
Run the above four lines with canvasapi==3.3.0 after substituting a valid course_id
Expected behavior
[e for e in course.query_audit_by_course()] would produce a list of CourseEvent objects
Describe the bug
The following code fails:
fails with
AttributeError: 'str' object has no attribute 'update'
because (I believe) the API has been changed to return a JSON object with three-keys, the basic structure is:with the second key containing what used to be returned by the API (a list of CourseEvent objects)
To Reproduce
Run the above four lines with canvasapi==3.3.0 after substituting a valid course_id
Expected behavior
[e for e in course.query_audit_by_course()]
would produce a list of CourseEvent objectsFix
I was able to fix the issue by adding
_root='events',
to the PaginatedList args in Course.query_audit_by_course()Environment information