Can't create questions using Python API in Production Canvas

Community Explorer

I use this python library
pip install canvasapi

I am successfully created a new quiz via a Python API

I use the following code to create questions for a quiz (that's online part of a bigger code)

def fillQuizWithQuestions(quiz_template_questions, new_quiz):
    for quiz_template_question in quiz_template_questions:
        quiz_question = new_quiz.create_question(question = {

When I run this code on Canvas Test ( )

Everything runs fine.

But if I try to run this on Canvas Beta ( ) or Canvas Production( ). I got an error

quiz_question = new_quiz.create_question(question = {
  File "C:\Users\Ideapad320\AppData\Local\Programs\Python\Python39\lib\site-packages\canvasapi\", line 62, in create_question
    response = self._requester.request(
  File "C:\Users\Ideapad320\AppData\Local\Programs\Python\Python39\lib\site-packages\canvasapi\", line 262, in request
    raise CanvasException(
canvasapi.exceptions.CanvasException: Encountered an error: status code 500

Why this code run on Canvas Test, but it does not work on Canvas Beta or Canvas Production?

Any idea of how to fix that problem?