-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
26 lines (19 loc) · 919 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from CanvasAPI.util import callhelper
from CanvasAPI import instance
__all__ = ["get", "post", "delete", "cross_list_section"]
def get(section_id, *args):
'''Get section information'''
url_str = "sections/{}{}".format(section_id, callhelper.args_to_params(*args))
return instance.call_api(url_str)
def delete(section_id):
'''Delete a section'''
url_str = "sections/{}".format(section_id)
return instance.call_api(url_str, method="DELETE")
def cross_list_section(section_id, new_course_id):
'''Cross-list a Section'''
url_str = "sections/{}/crosslist/{}".format(section_id, new_course_id)
return instance.call_api(url_str, method="POST")
def post(course_id, name):
'''Create course section'''
url_str = "courses/{}/sections".format(course_id)
return instance.call_api(url_str, method="POST", post_fields={"course_section[name]":name})