Skip to content

Commit

Permalink
Different error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
yukishirataco committed Dec 8, 2018
1 parent dd68b4d commit 5208b03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,5 @@ dmypy.json

#验证码
验证码.jpg
验证码.png
验证码.png
icon.ico
14 changes: 8 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
url_code = 'http://tcpe.upc.edu.cn:8086/Common/GetValiCode/'
url_login = 'http://tcpe.upc.edu.cn:8086/Account/DoLogin'
url_get_result = 'http://tcpe.upc.edu.cn:8086/Student/GetStuExpeDetail'
ua = 'Molella/5.0 (YJSNPinux 114.51,KMR OS 19.1) RingoWebKit/810.0 (KHTML, like Gecko) Chrome/49.0.2623.13 Safari/537.36'
ua = 'Molella/5.0 (YJSNPinux 114.51,KMR OS 19.1)'
header = {"User-Agent": ua, 'Host': 'tcpe.upc.edu.cn:8086'}

login_session = requests.session()
Expand All @@ -20,7 +20,7 @@
password = getpass.getpass(prompt='请输入你的密码(你的输入有可能没有显示,这是正常的现象):')
usertype = 'Student'
course_id = input(
'请输入你的课程编号,\n大学物理实验(2-1)请输入1\n大学物理实验(2-2)请输入2\n大学物理实验(小学期)请输入3 :')
'请输入你的课程编号,\n大学物理实验(2-1),请输入1\n大学物理实验(2-2),请输入2\n大学物理实验(小学期),请输入3 :')
valicode = input('请输入与程序同一目录下的 验证码.png 显示的验证码:')
login_session.get(url_login, headers=header)
post_data = {
Expand All @@ -32,11 +32,13 @@
}
data = login_session.post(url_login, data=post_data, headers=header)
# 登录

if data.text != 'Ok':
print('出错了,你的登录信息可能有误!')
# 登录信息错误

if data.text == 'ValidateErr':
print('验证码错误')
elif data.text == 'EmptyErr':
print('输入的用户名或者密码为空')
elif data.text == 'AccPwdErr':
print('用户名或密码错误')
else:
result = requests.get(
url_get_result, headers=header, cookies=getcookies.cookies.get_dict())
Expand Down

0 comments on commit 5208b03

Please sign in to comment.