Created
April 25, 2017 05:57
-
-
Save LukeXuan/e3b9189e6f5d6654a42df6a235db5870 to your computer and use it in GitHub Desktop.
UMJI Course list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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