-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-revamp-courses.py
More file actions
executable file
·34 lines (31 loc) · 1.07 KB
/
create-revamp-courses.py
File metadata and controls
executable file
·34 lines (31 loc) · 1.07 KB
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
import requests
import json
access_jwt = requests.post(
"https://backend.rev-amp.tech/api/v1/login/access-token",
data={"username": "test@rev-amp.tech", "password": "INSERT-PASSWORD-HERE"},
).json()["access_token"]
terms = requests.get(
"https://backend.rev-amp.tech/api/v1/terms/",
headers={"Authorization": f"Bearer {access_jwt}"},
).json()
courses = (
("Cloud Computing", "CSP42B"),
("High Performance Computing", "CS324"),
("Web Technology", "CS325"),
("Database Management System", "CS312"),
("Indian Tradition, Culture and Heritage", "WPC5"),
)
for term in terms:
if term["year"]["school"]["id"] != "38b357f2-71ef-49de-986e-6f2d2c1f1d02":
continue
for name, code in courses:
response = requests.post(
"https://backend.rev-amp.tech/api/v1/courses/",
json={
"name": name,
"course_code": code,
"term_id": term["id"],
},
headers={"Authorization": f"Bearer {access_jwt}"},
)
print(response.json(), response.status_code)