Skip to content

Instantly share code, notes, and snippets.

@LukeXuan
Created April 25, 2017 05:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LukeXuan/e3b9189e6f5d6654a42df6a235db5870 to your computer and use it in GitHub Desktop.
Save LukeXuan/e3b9189e6f5d6654a42df6a235db5870 to your computer and use it in GitHub Desktop.
UMJI Course list
import requests
import pprint
cookie = {
'JSESSIONID': '' # Fill in your session id
}
r = requests.get('http://coursesel.umji.sjtu.edu.cn/tpm/findAll_LessonTaskStudent.action', cookies=cookie)
data = r.json()['data']
elected = {}
for datum in data:
key = datum['courseShortName'] + datum['courseName']
if key in elected:
elected[key].append(datum['studentName'])
else:
elected[key] = [datum['studentName']]
file = open('data.json', 'w')
pprint.pprint(elected, file)
file.close()
for name in elected:
print(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment