Closed tecoholic closed 6 years ago
Hey @tecoholic!
The offer
and enroll_me
parameters are separate from the course
parameter.
The Canvas API documentation for creating a course calls for course[name]
and course[public_description]
to set the course's name and description, respectively. This is represented in CanvasAPI by passing a dictionary with keys name
and public_description
with the keyword course
, as you've done in the example provided. offer
and enroll_me
don't have the course[
prefix, so they should be passed as regular keyword arguments.
This should do the trick:
course_data = {
'name': 'Demo Math 101',
'public_description': 'This is demo course created for demo purposes',
'license': 'public_domain',
'default_view': 'assignments'
}
course = account.create_course(course=course_data, offer=True, enroll_me=True)
Also, though it shouldn't affect your results, I recommend upgrading your CanvasAPI version to 0.10.0. Gotta get the new stuff!
Please let us know if you have any questions. 😄
@Thetwam Thank you for your explanation. Passing the offer
and enroll_me
as keyword arguments make sense. We will of course be updating to 0.10.0
Environment:
Code:
Expected outcome:
A new course created in Canvas which is published and the admin user is is enrolled as the teacher.
Actual outcome:
Course is created, but, neither is the user enrolled as the teacher nor the course is published.