Hello,
I was experimenting with canvasapi in python, and wanted to try changing the nickname of my course. Here is what I have done so far:
from canvasapi import Canvastoken = 'my_token'base_url = 'https://canvas.unl.edu' canvas = Canvas(base_url, token)
stats = canvas.get_course(25870)
print(stats.name) # Math Stats I
stats.update(course = {'name': 'Statistical Distributions'})
print(stats.name) # Math Stats I
The program runs without error, but the name never updates. From the Dashboard, I am able to change the nickname of any course I am enrolled in. When I change the nickname and re-run the script, the stats course object updates to:
{...
'name': 'Statistical Distributions',
'original_name': 'Math Stats I',
...}
But this isn't working with the canvasapi, not even for courses I have TA access to. Any suggestions?
P.S. This may turn out to be a canvasapi specific issue. In which case, I will post the issue here: Issues · ucfopen/canvasapi · GitHub.
Solved! Go to Solution.
I haven't use the CanvasAPI python library, but it looks like you might be using the course.py, which updates the course, not your dashboard. Or mixing canvas.py/get_course(), and then using courses.py/update()...?
I think you need these.
canvasapi/canvas.py at 2c4016c071701bcef949685329acaec6115ffb3b · ucfopen/canvasapi · GitHub
def get_course_nicknames(self😞
def set_course_nickname(self, course, nickname😞
Hi @carl_corder
I am also going to share your question with the very awesome Canvas Developers group, where there are some smart folks.
Kelley
I haven't use the CanvasAPI python library, but it looks like you might be using the course.py, which updates the course, not your dashboard. Or mixing canvas.py/get_course(), and then using courses.py/update()...?
I think you need these.
canvasapi/canvas.py at 2c4016c071701bcef949685329acaec6115ffb3b · ucfopen/canvasapi · GitHub
def get_course_nicknames(self😞
def set_course_nickname(self, course, nickname😞
Thanks @kmeeusen for directing this question into the proper channels.
You are exactly right! The methods do exist, but I was trying to access them from the wrong object. Thanks for your resonse.