Describe the bug
All classes returns an int for their id, e.g. submission.id gives an int. But the NewQuiz object returns a string.
To Reproduce
Steps to reproduce the behavior:
from canvasapi import Canvas
url = os.environ['CANVAS_SERVER']
token = os.environ['CANVAS_TOKEN']
canvas = Canvas(url, token)
# Find the course and quiz
for course in canvas.get_courses():
if 'Sandbox dbosk' in str(getattr(course, 'name', '')):
print(f'Course ID: {course.id}, type: {type(course.id)}')
# Check New Quiz
for q in course.get_new_quizzes():
if 'API Test' in str(getattr(q, 'title', '')):
print(f'NewQuiz ID: {q.id}, type: {type(q.id)}')
print(f'NewQuiz class: {q.__class__.__name__}')
print(f'NewQuiz module: {q.__class__.__module__}')
break
# Check Classic Quiz for comparison
for q in course.get_quizzes():
print(f'ClassicQuiz ID: {q.id}, type: {type(q.id)}')
print(f'ClassicQuiz class: {q.__class__.__name__}')
break
break
That yields the output:
Course ID: 24725, type: <class 'int'>
NewQuiz ID: 367942, type: <class 'str'>
NewQuiz class: NewQuiz
NewQuiz module: canvasapi.new_quiz
ClassicQuiz ID: 66029, type: <class 'int'>
ClassicQuiz class: Quiz
Expected behavior
NewQuiz.id should yield an int.
Environment information
- Python version (
python --version): Python 3.12.3
- CanvasAPI version (
pip show canvasapi): 3.4.0
Additional context
CanvasObject.set_attributes() just takes the JSON response and sets attributes directly. The issue is that the New Quizzes API returns the id as a string in the JSON response, while the Classic Quizzes API returns it as an integer.
Describe the bug
All classes returns an int for their id, e.g. submission.id gives an int. But the NewQuiz object returns a string.
To Reproduce
Steps to reproduce the behavior:
That yields the output:
Expected behavior
NewQuiz.idshould yield an int.Environment information
python --version): Python 3.12.3pip show canvasapi): 3.4.0Additional context
CanvasObject.set_attributes()just takes the JSON response and sets attributes directly. The issue is that the New Quizzes API returns the id as a string in the JSON response, while the Classic Quizzes API returns it as an integer.