Requests ceased after a certain period of execution
My Environment
- Operating System: Windows 11
- Python Version: 3.12.5
- Browser: Edge, with official driver installed
Description
I was running the main.py and the requests ceased automatically after a certain period of time. I have tried different parameters in config.ini, but the issue persists. Specifically, after the console output something like 2024-09-13 16:29:39,813 - WARNING - 26.57% 的请求被拒绝,真实请求速度为 10.84 req/s,其中最低请求速度的课程为 1.36 req/s , there was no new output. Prior to this, thousands of requests had been sent cumulatively. Record in ruccourse.log was terminated too.
Many of my friends have encountered the same issue.
Solution
I created a .bat file to run and stop the script forcefully in a loop, though not elegant enough.
-
Step 1: Press
Windows + R, typenotepadand pressEnterto open Notepad. -
Step 2: Copy the following script:
@echo on :loop echo Running script... start /b python -u "path/to/main.py" timeout /t 300 /nobreak >nul taskkill /f /im python.exe goto loop -
Step 3 : Paste the Script into Notepad, save the file in the "Save as type" dropdown, selecting All Files. Then name the file something like
run_script.bat, and click Save. -
Step 4: Double click it and run.
我也发现了这个问题,我当时想的方案和你一样,我提供一些可能的原因给有缘人 debug:
- ruccourse.panjd.net 的 ssl 证书过期:如果是这个原因,我已经更新了网站证书,应该没有问题
- 请求速度太高:第二次,我以默认参数即 10/s 的请求速度时似乎就没有这个问题了
- 某些奇怪的错误码没有被正确处理:我观察到网站现在又有新的没被处理过的错误码了,不过我没有时间研究了