Skip to content

Creating Quiz Questions #648

Closed Answered by bennettscience
felkezac asked this question in Q&A
Apr 19, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Posting as a separate answer for clarity.

The library combines keyword arguments for endpoints which accept different parameters. You should pass dict objects directly to the function either directly or as a variable, like this:

question = {
    "question_name": "Sample question", 
    "question_text": "This is the question text.", 
    "question_type": "numerical_question"
}

q.create_question(question=question)

or

q.create_question(question={
    "question_name": "Sample question", 
    "question_text": "This is the question text.", 
    "question_type": "numerical_question"}
)

This is documented, along with other examples, here: https://canvasapi.readthedocs.io/en/stable/keyword-args.html

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@bennettscience
Comment options

@bennettscience
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by bennettscience
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants