-
Notifications
You must be signed in to change notification settings - Fork 186
Description
Describe the bug
When making an update call the following error occurs:
AttributeError Traceback (most recent call last)
Cell In[9], line 10
5 print(test.title)
6 #print(test.dict)
7 #q_id=quiz.id
8 #print(quiz.dict)
9 #print(quiz.student_access_code)
---> 10 updated_quiz = test.update(test={'student_access_code': New_code})
File /opt/anaconda3/lib/python3.12/site-packages/canvasapi/new_quiz.py:42, in NewQuiz.update(self, **kwargs)
32 def update(self, **kwargs):
33 """
34 Update a single New Quiz for the course.
35
(...)
40 :rtype: :class:canvasapi.new_quiz.NewQuiz
41 """
---> 42 endpoint = "courses/{}/quizzes/{}".format(self.course_id, self.id)
44 response = self._requester.request(
45 "PATCH",
46 endpoint,
47 _url="new_quizzes",
48 _kwargs=combine_kwargs(**kwargs),
49 )
50 response_json = response.json()
File /opt/anaconda3/lib/python3.12/site-packages/canvasapi/canvas_object.py:14, in CanvasObject.getattribute(self, name)
13 def getattribute(self, name):
---> 14 return super(CanvasObject, self).getattribute(name)
AttributeError: 'NewQuiz' object has no attribute 'course_id'
quizzes=course.get_new_quizzes()
for quiz in quizzes:
updated_quiz = quiz.update(quiz={'session_time_limit_in_seconds': 2760})
To Reproduce
Steps to reproduce the behavior:
define canvas url and API and create a canvas object
create a course object for the course you are working on
then run the following code:
quizzes=course.get_new_quizzes()
for quiz in quizzes:
updated_quiz = quiz.update(quiz={'session_time_limit_in_seconds': 2760})
Expected behavior
This should update the time limit on the quiz to 46 minutes
Environment information
- Python version (
3.12.7) - CanvasAPI version (
3.3.0)
Additional context
Add any other context about the problem here.