Skip to content

Commit 97dec3f

Browse files
committed
Add get_term_instructors()
1 parent 99dce45 commit 97dec3f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

app/scrapers/sis_api.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,32 @@ async def get_term_subjects(
5050
return data
5151

5252

53+
async def get_term_instructors(
54+
session: aiohttp.ClientSession, term: str
55+
) -> list[dict[str, str]]:
56+
"""
57+
Fetches the list of instructors for a given term from SIS. If the term is invalid
58+
or doesn't exist, returns an empty list.
59+
60+
Returned data format is as follows:
61+
[
62+
{
63+
"code": "71297",
64+
"description": "Abbott, Claude"
65+
},
66+
...
67+
]
68+
"""
69+
url = "https://sis9.rpi.edu/StudentRegistrationSsb/ssb/classSearch/get_instructor"
70+
params = {"term": term, "offset": 1, "max": 2147483647}
71+
async with session.get(url, params=params) as response:
72+
response.raise_for_status()
73+
raw_data = await response.text()
74+
raw_data = html.unescape(raw_data)
75+
data = json.loads(raw_data)
76+
return data
77+
78+
5379
async def get_all_attributes(session: aiohttp.ClientSession) -> list[dict[str, str]]:
5480
"""
5581
Fetches the master list of attributes from SIS.

0 commit comments

Comments
 (0)