def pwLogin(): print( '默认院校为吉林大学珠海学院,ID:' + tenantCode + '\n' + '若有需要,请自行抓包获取院校ID修改' + '\n' ) # 登录信息输入 account = input('请输入账号\n') password = input('请输入密码\n') # 获取Cookies print('\n获取Cookies中') cookie = WeiBanAPI.getCookie() print('Cookies获取成功') time.sleep(2) randomTimeStamp = random.randint(1E8, 1E12) print('验证码,浏览器打开 https://weiban.mycourse.cn/pharos/login/randImage.do?time=' + str(randomTimeStamp)) verifyCode = input('请输入验证码') # 登录请求 loginResponse = WeiBanAPI.login(account, password, tenantCode, randomTimeStamp, verifyCode, cookie) return loginResponse
password = input('请输入密码\n') # 获取Cookies print('\n获取Cookies中') cookie = WeiBanAPI.getCookie() print('Cookies获取成功') time.sleep(2) randomTimeStamp = random.randint(100000000, 1000000000000) print('验证码,浏览器打开 https://weiban.mycourse.cn/pharos/login/randImage.do?time=' + str(randomTimeStamp)) verifyCode = input('请输入验证码') # 登录请求 loginResponse = WeiBanAPI.login(account, password, tenantCode, randomTimeStamp, verifyCode, cookie) try: print('登录成功,userName:'******'data']['userName']) time.sleep(2) except BaseException: print('登录失败') print(loginResponse) # TODO: 这里的loginResponse调用没有考虑网络错误等问题 exit(0) # 请求解析并打印用户信息 try: print('请求用户信息') stuInfoResponse = WeiBanAPI.getStuInfo(loginResponse['data']['userId'], tenantCode, cookie) print('用户信息:' + stuInfoResponse['data']['realName'] + '\n' +