Skip to content

Commit

Permalink
0.1.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
MXWXZ committed Dec 25, 2018
1 parent 37d2d53 commit 97d0cf3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.1.4 2018-12-25
1. 修复抢选时提交错误问题
2. 取消抢选重新登陆的设置,可以连续选课。

v0.1.3 2018-12-24
1. 修复抢选时验证问题

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sjtu-automata
![Version](https://img.shields.io/badge/Version-0.1.3-blue.svg) ![Language](https://img.shields.io/badge/Language-Python3-red.svg) ![License](https://img.shields.io/badge/License-GPL--3.0-yellow.svg)
![Version](https://img.shields.io/badge/Version-0.1.4-blue.svg) ![Language](https://img.shields.io/badge/Language-Python3-red.svg) ![License](https://img.shields.io/badge/License-GPL--3.0-yellow.svg)

**注意!此版本为BETA版,未经过严格测试,可能存在BUG,如有问题请提交[issue](https://github.com/MXWXZ/AutoElect/issues)**

Expand Down Expand Up @@ -31,7 +31,8 @@ Linux > Windows >> ~~macOS=0(没钱无测试)~~

### [可选]验证码自动识别
Windows可以不装,Linux如无图形界面且无法通过其他方式打开`captcha.jpeg`文件需要安装。\
**未安装则每抢成功一门课都需要手动登陆,如需抢多个课则不能实现无人值守!**
~~**未安装则每抢成功一门课都需要手动登陆,如需抢多个课则不能实现无人值守!**~~\
仅针对海选,测试发现抢选提交后不会登出,因此可以实现无人值守。

Ubuntu 18.04:

Expand Down
2 changes: 1 addition & 1 deletion sjtu_automata/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__description__ = 'Auto elect script for SJTUer.'
__url__ = 'https://github.com/MXWXZ/sjtu-automata'
__update_url__ = 'https://raw.githubusercontent.com/MXWXZ/sjtu-automata/master/version'
__version__ = '0.1.3'
__version__ = '0.1.4'
__author__ = 'MXWXZ'
__author_email__ = '[email protected]'
__license__ = 'GNU General Public License v3 (GPLv3)'
Expand Down
5 changes: 4 additions & 1 deletion sjtu_automata/autoelect.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def select_teacher(self, teacherid, delay):
def submit(self):
if self.classtype != 4:
self.grade = None
req = submit(self.session, self.classtype,
self.req,self.data = submit(self.session,self.round, self.classtype,
self.data, self.params, self.grade)
if self.round == 1: # 1st elect will logout
self.islogin = False
Expand All @@ -231,6 +231,9 @@ def submit(self):

self.depth = 0
self.tmpreq = self.tmpparams = self.tmpdata = None
else:
self.classtype = 1
self.depth = 0

# TODO: more cmd in future

Expand Down
17 changes: 13 additions & 4 deletions sjtu_automata/electsys/automata.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,20 @@ def select_teacher(session, teacherid, data, params):
return req, data, param


def submit(session, classtype, data, params, extdata1=None):
def submit(session, round, classtype, data, params, extdata1=None):
"""Submit, need to relogin.
Args:
session: requests session, login session.
round: int, elect round, 1 for 1st, 2 for 2nd, 3 for 3rd.
classtype: int, elect class type, 1 for BiXiu, 2 for XianXuan, 3 for TongShi, 4 for RenXuan, 5 for XinSheng.
data: dict, select_class return post param.
params: dict, select_class return get param.
extdata1: string, for RenXuan is grade.
Returns:
requests request.
dict, post param with aspx param from last request.
"""
check_classtype(classtype)
pass_data = data
Expand All @@ -379,10 +381,17 @@ def submit(session, classtype, data, params, extdata1=None):
pass_data['OutSpeltyEP1$dpNj'] = extdata1
pass_data['OutSpeltyEP1$dpYx'] = '01000'

req, data = _request(session, 'POST', _get_classtype_fullurl(
if round == 1:
req, data = _request(session, 'POST', _get_classtype_fullurl(
classtype), params=params, data=pass_data, verify=False)

return req
# logout
if '微调结果' in req.text:
return req, None
return req, None
else:
req, data = _request(session, 'POST', _get_classtype_fullurl(
classtype), params=params, data=pass_data)
return req, data


def list_group(text, classtype):
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.3
0.1.4

0 comments on commit 97d0cf3

Please sign in to comment.