zhongxinghong / PKUAutoElective

北大选课网补退选阶段自动选课小工具
MIT License
668 stars 231 forks source link

elective可能会返回奇怪的结果导致re以及现在的反刷课机政策 #46

Open ghost-lu opened 4 years ago

ghost-lu commented 4 years ago

现在只要将刷新时长设置1秒以内就会在数分钟内被禁止访问elective, 更换ip后会恢复 同时大约几万个循环会出现elective返回奇怪页面导致异常结束 这是一个异常报告

[INFO] loop, 20:21:14, ======== END Loop 66760 ======== [INFO] loop, 20:21:14, Main loop sleep 1.061373699131935 s [INFO] loop, 20:21:14, Exception in thread Elective: Traceback (most recent call last): File "C:\Anaconda\lib\threading.py", line 917, in _bootstrap_inner self.run() File "C:\Anaconda\lib\threading.py", line 865, in run self._target(*self._args, self._kwargs) File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\loop.py", line 621, in run_elective_loop raise e File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\loop.py", line 325, in run_elective_loop r = page_r = elective.get_SupplyCancel() File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\elective.py", line 143, in get_SupplyCancel kwargs, File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\client.py", line 62, in _get return self._request('GET', url, params=params, kwargs) File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\client.py", line 57, in _request resp = self._session.send(prep, send_kwargs) File "C:\Anaconda\lib\site-packages\requests\sessions.py", line 629, in send r = dispatch_hook('response', hooks, r, kwargs) File "C:\Anaconda\lib\site-packages\requests\hooks.py", line 31, in dispatch_hook _hook_data = hook(hook_data, kwargs) File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\hook.py", line 47, in with_etree r._tree = get_tree_from_response(r) File "C:\Users\user\Desktop\PKUAutoElective-master\autoelective\parser.py", line 14, in get_tree_from_response return etree.HTML(r.text) # 不要用 r.content, 否则可能会以 latin-1 编码 File "C:\Anaconda\lib\site-packages\requests\models.py", line 851, in text if not self.content: File "C:\Anaconda\lib\site-packages\requests\models.py", line 827, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "C:\Anaconda\lib\site-packages\requests\models.py", line 749, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "C:\Anaconda\lib\site-packages\urllib3\response.py", line 461, in stream for line in self.read_chunked(amt, decode_content=decode_content): File "C:\Anaconda\lib\site-packages\urllib3\response.py", line 640, in read_chunked chunk = self._handle_chunk(amt) File "C:\Anaconda\lib\site-packages\urllib3\response.py", line 595, in _handle_chunk returned_chunk = self._fp._safe_read(self.chunk_left) File "C:\Anaconda\lib\http\client.py", line 610, in _safe_read chunk = self.fp.read(min(amt, MAXAMOUNT)) File "C:\Anaconda\lib\socket.py", line 589, in readinto return self._sock.recv_into(b) File "C:\Anaconda\lib\ssl.py", line 1049, in recv_into return self.read(nbytes, buffer) File "C:\Anaconda\lib\ssl.py", line 908, in read return self._sslobj.read(len, buffer) ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:2460)

oopsg1thub commented 4 years ago

参看之前issue,挂校外ip吧