-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexamples.txt
More file actions
44 lines (32 loc) · 857 Bytes
/
Copy pathexamples.txt
File metadata and controls
44 lines (32 loc) · 857 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
python manage.py shell
from cache import OpenClassIntegration, CLASSOWL_SCHOOL, MATH51, MATH53
oc = OpenClassIntegration(debug = True)
# Create course
math41_data = {
'institutionId': CLASSOWL_SCHOOL,
'courseTitle': 'Math 41: Linear Algebra',
'courseCode': 'MATH41',
'description': 'Difficult equations, naturally',
'credits': 4
}
r = oc.create_course(math41_data)
math41_id = r['data']['id']
# Read course we just created
math41 = oc.get_course(math41_id)
math41
# Update course details
updated_math41 = {
'id': math41_id,
'institutionId': CLASSOWL_SCHOOL,
'courseTitle': 'Math 41: Calculus',
'courseCode': 'MATH41',
'description': 'hehehehehe',
'credits': 5
}
r = oc.update_course(math41_id, updated_math41)
# Ensure course updated properly
math41 = oc.get_course(math41_id)
math41
# Delete course
r = oc.delete_course(math41_id)
r