fbuetler / asvz-bot

ASVZ Bot to enroll to lessons. Get a place when the registration opens or when a place gets free. Works for ETH, UZH and ZHAW students.
GNU General Public License v3.0
66 stars 25 forks source link

Issue when trying to enroll after spot has freed up #13

Closed PaulPerpetual closed 1 year ago

PaulPerpetual commented 1 year ago

Firstly thanks for the bot, it's really useful! Today I have encountered an issue though when trying to log in to a lesson that was already fully booked and a spot freed up it gave me the following error messages. I assume that by the time that the script tried to enroll the spot was already taken?

022-11-02 15:54:36 INFO Lesson is booked out. Rechecking in 30 secs.. 2022-11-02 15:55:06 INFO Lesson is booked out. Rechecking in 30 secs.. 2022-11-02 15:55:37 INFO Lesson is booked out. Rechecking in 30 secs.. 2022-11-02 15:56:07 INFO Lesson is booked out. Rechecking in 30 secs.. 2022-11-02 15:56:38 INFO Lesson is booked out. Rechecking in 30 secs.. 2022-11-02 15:57:11 INFO Lesson has free places 2022-11-02 15:57:14 INFO Login to 'Universität Zürich' 2022-11-02 15:57:20 INFO Submitted login credentials 2022-11-02 15:57:23 INFO Valid login credentials 2022-11-02 15:57:23 INFO Waiting for enrollment Traceback (most recent call last): File "asvz_bot.py", line 596, in main() File "asvz_bot.py", line 592, in main enroller.enroll() File "asvz_bot.py", line 290, in enroll WebDriverWait(driver, 5 * 60).until( File "/Users/../asvz-bot-master/src/.venv/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 89, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: 0 chromedriver 0x0000000102e252c8 chromedriver + 4752072 1 chromedriver 0x0000000102da5463 chromedriver + 4228195 2 chromedriver 0x0000000102a08b18 chromedriver + 441112 3 chromedriver 0x0000000102a45e21 chromedriver + 691745 4 chromedriver 0x0000000102a46061 chromedriver + 692321 5 chromedriver 0x0000000102a815e4 chromedriver + 935396 6 chromedriver 0x0000000102a66d2d chromedriver + 826669 7 chromedriver 0x0000000102a7f134 chromedriver + 926004 8 chromedriver 0x0000000102a66b33 chromedriver + 826163 9 chromedriver 0x0000000102a379fd chromedriver + 633341 10 chromedriver 0x0000000102a39051 chromedriver + 639057 11 chromedriver 0x0000000102df230e chromedriver + 4543246 12 chromedriver 0x0000000102df6a88 chromedriver + 4561544 13 chromedriver 0x0000000102dfe6df chromedriver + 4593375 14 chromedriver 0x0000000102df78fa chromedriver + 4565242 15 chromedriver 0x0000000102dcd2cf chromedriver + 4391631 16 chromedriver 0x0000000102e165b8 chromedriver + 4691384 17 chromedriver 0x0000000102e16739 chromedriver + 4691769 18 chromedriver 0x0000000102e2c81e chromedriver + 4782110 19 libsystem_pthread.dylib 0x00007ff81d3ae4e1 _pthread_start + 125 20 libsystem_pthread.dylib 0x00007ff81d3a9f6b thread_start + 15

fbuetler commented 1 year ago

Yeah, I recently also encountered this issue, and it may be indeed the case that it tries to enrol into a lesson that recently had free places but has none any more (someone else was faster).

As a workaround, I run the bot as follows, but I think this can also be integrated into the bot itself:

while ! python asvz_bot.py lesson <lessonId>; do done
fbuetler commented 1 year ago

I tried to address this issue with version 1.4.1. Let me know if this error still occurs.

PaulPerpetual commented 1 year ago

thanks!

sorry if this is off-topic but did you figure a way to run the code online? (so one does not have to have the own laptop turned on at the given time)

fbuetler commented 1 year ago

You can run the bot everywhere you have python3 and chrome/chromedriver installed. This is out of scope for this project, but you can check out for example https://fly.io or https://digitalocean.com.

Glanfaloth commented 1 year ago

Hi sorry I think this error still occurs

2023-01-25 08:59:52 INFO     Lesson is booked out. Rechecking in 15 secs..
2023-01-25 09:00:10 INFO     Lesson has free places
Traceback (most recent call last):
  File "/asvz-bot/src/asvz_bot.py", line 614, in <module>
    main()
  File "/asvz-bot/src/asvz_bot.py", line 610, in main
    enroller.enroll()
  File "/asvz-bot/src/asvz_bot.py", line 292, in enroll
    self.__organisation_login(driver)
  File "/asvz-bot/src/asvz_bot.py", line 395, in __organisation_login
    WebDriverWait(driver, 20).until(
  File "/asvz-bot/src/.venv/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 89, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Stacktrace:
#0 0x5608de4a1303 <unknown>
#1 0x5608de275d37 <unknown>
#2 0x5608de2b25b2 <unknown>
#3 0x5608de2b26c1 <unknown>
#4 0x5608de2ecb34 <unknown>
#5 0x5608de2d29ad <unknown>
#6 0x5608de2ea88c <unknown>
#7 0x5608de2d2753 <unknown>
#8 0x5608de2a5a14 <unknown>
#9 0x5608de2a6b7e <unknown>
#10 0x5608de4f032e <unknown>
#11 0x5608de4f3c0e <unknown>
#12 0x5608de4d6610 <unknown>
#13 0x5608de4f4c23 <unknown>
#14 0x5608de4c8545 <unknown>
#15 0x5608de5156a8 <unknown>
#16 0x5608de515836 <unknown>
#17 0x5608de530d13 <unknown>
#18 0x7f5a3ed61609 start_thread