junyi-99 / mustplus.server Goto Github PK
View Code? Open in Web Editor NEWMacau University of Science and Technology Campus Application ( Server )
License: GNU General Public License v3.0
Macau University of Science and Technology Campus Application ( Server )
License: GNU General Public License v3.0
可以加一个 “知道学生看了哪些通告” 功能
可以显示期末考试教室和时间座位号
I did not execute this function, but I can see that this function will take 6 seconds to retrieve the user‘s information.
Each login takes 3 seconds, and you login twice in this function, which means that the function is inefficient.
Please make a change.
# Author : Aikov
# Time :2019/4/30
# Status:Finished
def get_info(userid, password):
try:
student = Student.objects.get(student_id=userid)
except ObjectDoesNotExist:
student = Student.objects.create(student_id=userid)
cookies = get_cookie(userid, password)
if cookies == 0:
return 0
# Find info on personal info
url = 'https://coes-stud.must.edu.mo/coes/StudentInfo.do'
r = requests.get(url=url, cookies=cookies)
# Find Chinese name
tar = 'Name in Chinese: </td> <td class="blackfont"> '
pos1 = r.text.find(tar) + tar.__len__()
pos2 = r.text.find(' </td>', __start=pos1)
student.name_zh = r.text[pos1:pos2]
# Find English name
tar = 'Name in English: </td> <td class="blackfont"> '
pos1 = r.text.find(tar) + tar.__len__()
pos2 = r.text.find(' </td>', __start=pos1)
student.name_en = r.text[pos1:pos2]
# Find sex
tar = 'Gender: </td> <td class="blackfont">'
pos1 = r.text.find(tar) + tar.__len__()
pos2 = r.text.find('</td>', __start=pos1)
student.sex = r.text[pos1:pos2]
# Find birthday
tar = 'Date of Birth: </td> <td class="blackfont">'
pos1 = r.text.find(tar) + tar.__len__()
pos2 = r.text.find('</td>', __start=pos1)
date = r.text[pos1:pos2]
date = date.split('/')
student.birthday.day = int(date[0])
student.birthday.mouth = int(date[1])
student.birthday.year = int(date[2])
# Find info on study plan
url = 'https://coes-stud.must.edu.mo/coes/StudyPlanGroup.do'
r = requests.get(url=url, cookies=cookies)
# Find Faculty
tar = 'Faculty: </td> <td class="blackfont">'
pos1 = r.text.find(tar) + tar.__len__()
pos2 = r.text.find('</td>', __start=pos1)
name = r.text[pos1:pos2]
try:
faculty = Faculty.objects.get(name_en=name)
except ObjectDoesNotExist:
faculty = Faculty.objects.get(name_zh=name)
student.faculty_id = faculty.id
# Find Major
tar = 'Major: '
pos = r.text.find(tar)
# 不知道为什么两个tar之间在源码里有一个回车,这样规避一下
tar = '</td> <td class="blackfont"> '
pos1 = r.text.find(tar, __start=pos) + tar.__len__()
pos2 = r.text.find(' </td>', __start=pos1)
name = r.text[pos1:pos2]
try:
major = Major.objects.get(name_en=name)
except ObjectDoesNotExist:
major = Major.objects.get(name_zh=name)
student.major_id = major.id
# 已经从COES爬完了个人信息
student.save()
url = 'https://coes-stud.must.edu.mo/coes/logout.do'
requests.post(url=url, cookies=r.cookies)
加入防伪课表截图的功能
The user changed the password while using the MUST+
StudentTakeCourse relationship should add a field semester
加一个设备显示
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.