-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-revamp-terms.py
executable file
·58 lines (53 loc) · 2.01 KB
/
create-revamp-terms.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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"]
years = requests.get(
"https://backend.rev-amp.tech/api/v1/years/",
headers={"Authorization": f"Bearer {access_jwt}"},
).json()
for year in years:
response = requests.post(
"https://backend.rev-amp.tech/api/v1/terms/",
json={
"year_id": year["id"],
"current_year_term": 1,
"school_id": year["school_id"],
"has_electives": False,
"start_date": f"{year['start_year']}-07-10",
"end_date": f"{year['start_year']}-10-20",
"name": f"Term 1, {year['start_year']} - {year['end_year']}",
},
headers={"Authorization": f"Bearer {access_jwt}"},
)
print(response.status_code, response.json())
response = requests.post(
"https://backend.rev-amp.tech/api/v1/terms/",
json={
"year_id": year["id"],
"current_year_term": 2,
"school_id": year["school_id"],
"has_electives": False,
"start_date": f"{year['start_year']}-11-10",
"end_date": f"{year['end_year']}-02-10",
"name": f"Term 2, {year['start_year']} - {year['end_year']}",
},
headers={"Authorization": f"Bearer {access_jwt}"},
)
print(response.status_code, response.json())
response = requests.post(
"https://backend.rev-amp.tech/api/v1/terms/",
json={
"year_id": year["id"],
"current_year_term": 3,
"school_id": year["school_id"],
"has_electives": False,
"start_date": f"{year['end_year']}-03-10",
"end_date": f"{year['end_year']}-6-05",
"name": f"Term 3, {year['start_year']} - {year['end_year']}",
},
headers={"Authorization": f"Bearer {access_jwt}"},
)
print(response.status_code, response.json())