-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.py
39 lines (31 loc) · 1.11 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
# 程序入口
import downloads
import setting
import time
import sys
import choose_course
if __name__ == "__main__":
for i in range(setting.count):
for course in setting.courses:
try:
response = choose_course.start_choose(
course['id'], course['type'])
time.sleep(setting.delay/1000.0)
if "该课程超过课容量" in response:
print("该课程超过课容量")
break
elif "添加选课志愿成功" in response:
print("抢课成功")
break
else:
print(course['name']+": "+response)
except KeyboardInterrupt:
print("通过键盘中断退出程序")
sys.exit()
except:
print("出现错误,请检查设置setting.py部分是否填写正确")
print("抢课结束")
print("======================")
print("您现在选课的结果如下")
choose_course.query_result()