Beispiel #1
0
def find_jwc_pwd():
    '''教务处密码找回'''
    url = 'http://jwgl.nepu.edu.cn/framework/enteraccount.jsp'
    data = {'account': '130101140323'}
    session = requests.session()
    # info=session.post(url,data).text

    data2 = {'account': '130101140323', 'sfzjh': '230622199407032050'}
    info = session.post('http://jwgl.nepu.edu.cn/yhxigl.do?method=resetPasswd',
                        data2)
    if info.status_code == 200:
        if '出错页面' in info.text:
            return falseReturn(msg='学号输入错误')
        elif '身份证件号输入错误或者你在系统中没有身份证号' in info.text:
            return falseReturn(msg='身份证号输入错误')
        else:
            print(info.text)
            return trueReturn(msg='密码已重置为身份证后六位')
    else:
        return falseReturn(msg='系统暂时无法访问,请稍后再试')
Beispiel #2
0
def login_jwc(username, pwd):
    '''教务处登陆'''
    code = login.get("http://jwgl.nepu.edu.cn/verifycode.servlet",
                     headers=header)
    if code.status_code == 200:
        im = Image.open(BytesIO(code.content))
        im = im.convert('L')
        yzm = get_validate_code_from_image(im)
        data = {'USERNAME': username, 'PASSWORD': pwd, 'RANDOMCODE': yzm}
        success = login.post('http://jwgl.nepu.edu.cn/Logon.do?method=logon',
                             data=data,
                             headers=header)

        if "验证码错误!!" in success.text:
            login_jwc()
        elif '该帐号不存在或密码错误,请联系管理员' in success.text:
            return falseReturn(msg='学号不存在或密码错误')
        else:
            login.get('http://jwgl.nepu.edu.cn/Logon.do?method=logonBySSO',
                      headers=header)
        return trueReturn(data=login)
    else:
        return falseReturn(msg='教务系统暂时无法访问')
Beispiel #3
0
def get_info_room(kc='0304', jsbh='00030'):
    '''查询教室占用情况'''  #还需要完善,暂时不启用
    zc = today_week()['zhou']
    kcsj = str(today_week()['week']) + kc
    if login1['status'] == False:
        return falseReturn(msg='暂时不能查询')
    else:
        login = login1['data']
        url = 'http://jwgl.nepu.edu.cn/jiaowu/kxjsgl/kxjsgl.do?method=goQueryjszyqk&xnxqh=2018-2019-2&jsbh='+jsbh+'&kcsj='+kcsj+'&typewhere=' \
               'xszq&startZc='+str(zc)+'&endZc='+str(zc)+'&startJc=&endJc=&startXq=1&endXq=1&jszt=&type=add'
        room_info = login.get(url).text
        soup = BeautifulSoup(room_info, 'lxml')
        tr = soup.find_all('tr')
        new_lb = []
        title = {
            "周次:": "zc",
            "教室状态:": "status",
            "教室:": "classroom",
            "时间标志:": "sjbz",
            "备注:": "text",
            "时间:": "time",
            "申 请 人:": "shenqingren",
            "课程:": "class"
        }
        for i in tr[2:3]:
            td = i.find_all('td')

            for i in td[1:]:
                new_lb.append(i.get_text('', '\r\n\t\t\t\t\t\t\t\t\t\t'))
        #print(new_lb)

        info = {}
        a = 0
        b = 2
        print(new_lb)
        for i in range(8):
            info[title[new_lb[a]]] = new_lb[b]
            a = a + 3
            b = b + 3
        print(info)
        return trueReturn(data=info)