Esempio n. 1
0
 def _get_captcha(self, url=URL.jwxt_captcha()):
     r = self.get(url)
     im = Image.open(BytesIO(r.content))
     if url == URL.aolan_captcha():
         return str(AolanCaptcha(im))
     if url == URL.jwxt_captcha():
         return str(ZhengfangCaptcha(im))
Esempio n. 2
0
 def login(self, account, password):
     """
     登录教务系统 jwxt.njupt.edu.cn
     :param account: 南邮学号
     :param password: 密码
     :return: {'r': 1, "msg": "登录失败"} 或 {'r': 0, 'msg': '登录成功'}
     """
     data = {
         "__VIEWSTATE": self._get_viewstate(),
         'txtUserName': account,
         'TextBox2': password,
         'RadioButtonList1': "%D1%A7%C9%FA",
         "txtSecretCode": self._get_captcha(URL.jwxt_captcha()),
         "Button1": "",
         "hidPdrs": "",
         "hidsc": ""
     }
     return self._login_execute(url=URL.jwxt_login(), data=data)
Esempio n. 3
0
 def _get_captcha(self, url=URL.jwxt_captcha()):
     r = self.get(url)
     im = Image.open(BytesIO(r.content))
     im.show()
     captcha = input("输入验证码:")
     return captcha