Giter Site home page Giter Site logo

fbuetler / asvz-bot Goto Github PK

View Code? Open in Web Editor NEW
67.0 3.0 25.0 131 KB

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.

License: GNU General Public License v3.0

Python 97.96% Dockerfile 2.04%
asvz bot python3

asvz-bot's Introduction

⚠️ asvz bot is no longer maintained

This repository has been archived on Dec 18th, 2023.

The ASVZ IT department has kindly asked me to discontinue this project in compliance with their Fair Play Rules.

The asvz bot

This repo contains a script to automatically enroll to ASVZ lessons

Features

  • Enroll to lesson
    • based on lesson ID (for lessons visited once)
    • based on sport ID, day, time, trainer, level, facility (for lessons visited periodically)
  • Enroll to lesson that is already full
  • Login as a member of
    • ETH
    • UZH
    • ZHAW
    • PHZH
    • ASVZ
  • Save your credentials locally and reuse them on the next run
  • Note: UZH, ZHAW and PHZH use SWITCH edu-ID as login (email + password). ETH uses own login (nethz + password) ASVZ uses own login (ASVZ-ID + password)

Run

Prerequisites

You need to install the following:

First time

cd src
python3 -m pip install virtualenv
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 asvz_bot.py -h

After the first time

cd src
source .venv/bin/activate
python3 asvz_bot.py -h

Examples

Enroll by lesson ID and save credentials (locally in .asvz-bot.json)

python3 asvz_bot.py --organisation "ETH" --username "flbuetle" --save-credentials lesson 196346

Enroll by lesson ID and use saved credentials

python3 asvz_bot.py lesson 196346

Enroll by lesson attributes and use saved credentials

python3 asvz_bot.py training \
  --weekday "Mo" \
  --start-time "18:15" \
  --trainer "Karin Hollenstein" \
  --level "Fortgeschrittene" \
  --facility "Sport Center Hönggerberg" \
  45743

Docker

In order to run the script using docker, follow these two steps:

  1. Install docker and docker compose (usually included) as explained on the official docker website.

  2. Configure event parameters in the env file. Provide the required values as described above or on the cli help. Make sure to comment out or remove any lines for values you are not using.

  3. Build the image using the following command from the repository's base directory:

    docker compose --env-file env up --build

It is possible to configure multiple env files for different recurring events and start the bot with the appropriate one by specifying the --env-file flag as follows:

  1. Copy the env file and name it after your desired event, using one of the following patterns: myEvent.env or myEvent-env
  2. Run the bot using the following command, where you replace the file name with your actual file name:
    docker compose --env-file myEvent.env up --build

asvz-bot's People

Contributors

abrandemuehl avatar brb2000 avatar cyprienhoelzl avatar fbuetler avatar leopold-franz avatar masus04 avatar mathinic avatar peschee avatar sant0s12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asvz-bot's Issues

Element on website not found

Dear Florian, could you look into this error when you have time? Thank you

2023-03-07 21:55:48 ERROR    Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues
2023-03-07 21:55:48 ERROR    Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues
Traceback (most recent call last):
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 614, in <module>
    main()
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 610, in main
    enroller.enroll()
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 267, in enroll
    raise e
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 264, in enroll
    ) = AsvzEnroller.__get_enrollment_and_start_time(driver)
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 336, in __get_enrollment_and_start_time
    raise e
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 333, in __get_enrollment_and_start_time
    lesson_start = AsvzEnroller.__get_lesson_time(driver)
  File "/Users/Downloads/asvz-bot/src/asvz_bot.py", line 374, in __get_lesson_time
    lesson_interval_raw = driver.find_element(
  File "/Users/Downloads/asvz-bot/src/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 1244, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "/Users/Downloads/asvz-bot/src/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 424, in execute
    self.error_handler.check_response(response)
  File "/Users/Downloads/asvz-bot/src/.venv/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//dl[contains(., 'Datum/Zeit')]/dd"}
  (Session info: headless chrome=111.0.5563.64)

Issue when trying to enroll after spot has freed up

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

Handle "Canceled" events

Current Behaviour
The following stack trace is raised when trying to enroll for a canceled event:

asvz-bot  | 2023-12-06 13:08:10 INFO     Checking login credentials
asvz-bot  | 2023-12-06 13:08:12 INFO     Login to 'ETH Zürich'
asvz-bot  | 2023-12-06 13:08:14 INFO     Submitted login credentials
asvz-bot  | 2023-12-06 13:08:17 INFO     Valid login credentials
asvz-bot  | 2023-12-06 13:08:21 INFO     Starting enrollment
asvz-bot  | 2023-12-06 13:08:21 INFO     Enrollment is already open. Checking for available places.
asvz-bot  | 2023-12-06 13:08:25 INFO     Lesson has free places
asvz-bot  | 2023-12-06 13:08:25 INFO     Login to 'ETH Zürich'
asvz-bot  | 2023-12-06 13:08:26 INFO     Submitted login credentials
asvz-bot  | 2023-12-06 13:08:29 INFO     Valid login credentials
asvz-bot  | 2023-12-06 13:08:29 INFO     Waiting for enrollment

After which it simply hangs.

Expected Behaviour
The bot should recognize the event has been canceled, print a suitable error message and terminate.

selenium.common.exceptions.ElementNotInteractableException:

I get the following error when running the script, does anyone know to happen what causes this issue?

File "C:\asvz-bot\src\asvz_bot.py", line 397, in __organisation_login driver.find_element(By.XPATH, "//input[@id='AsvzId']").send_keys(
File "C:\Python311\Lib\site-packages\selenium\webdriver\remote\webelement.py", line 230, in send_keys
self._execute(
File "C:\Python311\Lib\site-packages\selenium\webdriver\remote\webelement.py", line 403, in _execute
return self._parent.execute(command, params)
File "C:\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "C:\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: headless chrome=102.0.5005.63)

Multiple errors and AuthGuard warning

I have the following errors and warnings when I run your code

2023-03-07 21:11:19 INFO     Checking login credentials

DevTools listening on ws://127.0.0.1:50939/devtools/browser/f201eec3-147e-4e74-a12f-200b637adc1c
[0307/211120.770:INFO:CONSOLE(1)] "WARNING: AuthGuard should be implemented for this route:  https://schalter.asvz.ch/tn/lessons/434778", source: https://schalter.asvz.ch/tn/main.0d96478c7988d889.js (1)
[0307/211120.776:INFO:CONSOLE(1)] "ERROR [object Object]", source: https://schalter.asvz.ch/tn/main.0d96478c7988d889.js (1)
[0307/211120.776:INFO:CONSOLE(1)] "ERROR [object Object]", source: https://schalter.asvz.ch/tn/main.0d96478c7988d889.js (1)
2023-03-07 21:11:22 INFO     Login to 'ETH Zürich'
2023-03-07 21:11:23 INFO     Submitted login credentials
2023-03-07 21:12:02 INFO     Valid login credentials
[0307/211203.895:INFO:CONSOLE(1)] "WARNING: AuthGuard should be implemented for this route:  https://schalter.asvz.ch/tn/lessons/434778", source: https://schalter.asvz.ch/tn/main.0d96478c7988d889.js (1)
[0307/211203.895:INFO:CONSOLE(1)] "ERROR [object Object]", source: https://schalter.asvz.ch/tn/main.0d96478c7988d889.js (1)
2023-03-07 21:12:08 ERROR    Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues
2023-03-07 21:12:08 ERROR    Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues
Traceback (most recent call last):
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 605, in <module>
    main()
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 601, in main
    enroller.enroll()
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 267, in enroll
    raise e
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 264, in enroll
    ) = AsvzEnroller.__get_enrollment_and_start_time(driver)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 336, in __get_enrollment_and_start_time
    raise e
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 332, in __get_enrollment_and_start_time
    enrollment_start = AsvzEnroller.__get_enrollment_time(driver)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lorin\OneDrive\Dokumente\ETH\Sonstiges\asvz_bot\asvz_bot.py", line 342, in __get_enrollment_time
    enrollment_interval_raw = driver.find_element(
                              ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lorin\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 830, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lorin\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "C:\Users\lorin\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//dl[contains(., 'Einschreibezeitraum')]/dd"}
  (Session info: headless chrome=110.0.5481.178)
Stacktrace:
Backtrace:
        (No symbol) [0x004337D3]
        (No symbol) [0x003C8B81]
        (No symbol) [0x002CB36D]
        (No symbol) [0x002FD382]
        (No symbol) [0x002FD4BB]
        (No symbol) [0x00333302]
        (No symbol) [0x0031B464]
        (No symbol) [0x00331215]
        (No symbol) [0x0031B216]
        (No symbol) [0x002F0D97]
        (No symbol) [0x002F253D]
        GetHandleVerifier [0x006AABF2+2510930]
        GetHandleVerifier [0x006D8EC1+2700065]
        GetHandleVerifier [0x006DC86C+2714828]
        GetHandleVerifier [0x004E3480+645344]
        (No symbol) [0x003D0FD2]
        (No symbol) [0x003D6C68]
        (No symbol) [0x003D6D4B]
        (No symbol) [0x003E0D6B]
        BaseThreadInitThunk [0x76757D69+25]
        RtlInitializeExceptionChain [0x7755BB9B+107]
        RtlClearBits [0x7755BB1F+191]

Any chance you can help me sort this out?

Thanks for this lovely idea of a script by the way :)

2FA causing problems (?)

Thanks for this useful tool! ;)

I am having issues with using it, due to the newly added 2FA. If I run the script with

python3 asvz_bot.py --organisation "UZH" --username "username" --save-credentials lesson lessonID

I receive the text message from SWITCHsms for 2FA on my phone and the output below. Are there any solutions (planned) to be able to use the tool even with the enforced 2FA?

2023-04-25 14:24:49 INFO     Checking login credentials
2023-04-25 14:24:51 INFO     Login to 'Universität Zürich'
2023-04-25 14:24:56 INFO     Submitted login credentials
2023-04-25 14:24:59 WARNING  Authentication might have failed. Current URL is 'https://uzh.login.eduid.ch/idp/profile/SAML2/Redirect/SSO?execution=e1s3'
2023-04-25 14:25:05 ERROR    Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues
2023-04-25 14:25:05 ERROR    Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues
Traceback (most recent call last):
  File "asvz_bot.py", line 610, in <module>
    main()
  File "asvz_bot.py", line 606, in main
    enroller.enroll()
  File "asvz_bot.py", line 272, in enroll
    raise e
  File "asvz_bot.py", line 269, in enroll
    ) = AsvzEnroller.__get_enrollment_and_start_time(driver)
  File "asvz_bot.py", line 341, in __get_enrollment_and_start_time
    raise e
  File "asvz_bot.py", line 337, in __get_enrollment_and_start_time
    enrollment_start = AsvzEnroller.__get_enrollment_time(driver)
  File "asvz_bot.py", line 347, in __get_enrollment_time
    enrollment_interval_raw = driver.find_element(
  File "/home/lufr/asvz-bot-master/src/.venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 830, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "/home/lufr/asvz-bot-master/src/.venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/lufr/asvz-bot-master/src/.venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//dl[contains(., 'Einschreibezeitraum')]/dd"}
  (Session info: headless chrome=112.0.5615.165)
Stacktrace:
#0 0x562afc06efe3 <unknown>
#1 0x562afbdadd36 <unknown>
#2 0x562afbdeac4d <unknown>
#3 0x562afbdead61 <unknown>
#4 0x562afbe266a4 <unknown>
#5 0x562afbe0b8ed <unknown>
#6 0x562afbe24232 <unknown>
#7 0x562afbe0b693 <unknown>
#8 0x562afbdde03a <unknown>
#9 0x562afbddf17e <unknown>
#10 0x562afc030dbd <unknown>
#11 0x562afc034c6c <unknown>
#12 0x562afc03e4b0 <unknown>
#13 0x562afc035d63 <unknown>
#14 0x562afc008c35 <unknown>
#15 0x562afc059138 <unknown>
#16 0x562afc0592c7 <unknown>
#17 0x562afc067093 <unknown>
#18 0x7fefdaef2609 start_thread

TimeoutException when trying to check login credentials

I get the following error when trying to log in:

2023-03-02 12:23:23 INFO     Checking login credentials
Traceback (most recent call last):
  File "asvz_bot.py", line 606, in <module>
    main()
  File "asvz_bot.py", line 602, in main
    enroller.enroll()
  File "asvz_bot.py", line 261, in enroll
    self.__organisation_login(driver)
  File "asvz_bot.py", line 383, in __organisation_login
    WebDriverWait(driver, 20).until(
  File "~/asvz-bot/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                        0x0000000101338138 chromedriver + 4923704
1   chromedriver                        0x00000001012b09d3 chromedriver + 4368851
2   chromedriver                        0x0000000100ef9787 chromedriver + 472967
3   chromedriver                        0x0000000100f3dba3 chromedriver + 752547
4   chromedriver                        0x0000000100f3ddf1 chromedriver + 753137
5   chromedriver                        0x0000000100f84734 chromedriver + 1042228
6   chromedriver                        0x0000000100f66fdd chromedriver + 921565
7   chromedriver                        0x0000000100f81c0f chromedriver + 1031183
8   chromedriver                        0x0000000100f66d23 chromedriver + 920867
9   chromedriver                        0x0000000100f2da4b chromedriver + 686667
10  chromedriver                        0x0000000100f2f044 chromedriver + 692292
11  chromedriver                        0x00000001013038fe chromedriver + 4708606
12  chromedriver                        0x0000000101308e22 chromedriver + 4730402
13  chromedriver                        0x00000001013116bf chromedriver + 4765375
14  chromedriver                        0x0000000101309e80 chromedriver + 4734592
15  chromedriver                        0x00000001012da975 chromedriver + 4540789
16  chromedriver                        0x000000010132be78 chromedriver + 4873848
17  chromedriver                        0x000000010132bff5 chromedriver + 4874229
18  chromedriver                        0x00000001013406de chromedriver + 4957918
19  libsystem_pthread.dylib             0x00007ff80f4634e1 _pthread_start + 125
20  libsystem_pthread.dylib             0x00007ff80f45ef6b thread_start + 15

Also after increasing the waiting time from 20sec to 120sec and using different internet connections the error persists.

I use a Mac and switch to log in (UZH)

No version satisfies venv

When I execute

cd src
python3 -m pip install venv
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 asvz_bot.py -h

in the terminal, it throws these two errors. Any idea why?

ERROR: Could not find a version that satisfies the requirement venv (from versions: none)
ERROR: No matching distribution found for venv

Element on website not found

Hi Florian,
I started using the bot today and I got this error while running:

2023-09-26 19:49:43 INFO     Checking login credentials
2023-09-26 19:49:52 INFO     Login to 'Universität Zürich'
2023-09-26 19:50:00 ERROR    Element on website not found! This may happen when the website was updated recently.
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@id='password']"}

Element on website not found

When running asvz_bot.py with a valid lesson ID, the script was not able to find the element

2023-02-02 09:19:49 ERROR Element on website not found! This may happen when the website was updated recently. Please report this incident to: https://github.com/fbuetler/asvz-bot/issues

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//dl[contains(., 'Datum/Zeit')]/dd"}
(Session info: headless chrome=...)

ChromeDriver and Chrome version incompatible

Hey Florian,

Haven't been using this for a long time and today I got this error when running

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.187 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

I couldn't find an older version of Chrome... Any fix? Thanks!

Events not supported

Events are not supported. Events are different from lesson and training in that they represent a block of n lessons that have to be booked in advance, e.g. Bogensport.

In order to support this, the bot would also have to support searching further into the future than one week.

ASVZ login direkt als alumni

Hallo
Ich versucht das hier für einen Freund einzurichten. Er ist alumni und hat einen direkten ASVZ login. Die Org ASVZ gibt es aber nicht und ZHAW (wo er früher hingehörte) klappt nicht.
Ist es viel Aufwand das für den ASVZ Login hinzubiegen? (https://auth.asvz.ch/Account/Login)

list index out of range

Hi the script was running fine before but when a spot becomes free I got this

2023-01-17 10:01:25 INFO     Lesson has free places
Traceback (most recent call last):
  File "/local/home/asvz-bot/src/asvz_bot.py", line 606, in <module>
    main()
  File "/local/home/asvz-bot/src/asvz_bot.py", line 602, in main
    enroller.enroll()
  File "/local/home/asvz-bot/src/asvz_bot.py", line 289, in enroll
    self.__organisation_login(driver)
  File "/local/home/asvz-bot/src/asvz_bot.py", line 383, in __organisation_login
    WebDriverWait(driver, 20).until(
  File "/local/home/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 0x55c8c92a2303 <unknown>
#1 0x55c8c9076d37 <unknown>
#2 0x55c8c90b35b2 <unknown>
#3 0x55c8c90b36c1 <unknown>
#4 0x55c8c90edb34 <unknown>
#5 0x55c8c90d39ad <unknown>
#6 0x55c8c90eb88c <unknown>
#7 0x55c8c90d3753 <unknown>
#8 0x55c8c90a6a14 <unknown>
#9 0x55c8c90a7b7e <unknown>
#10 0x55c8c92f132e <unknown>
#11 0x55c8c92f4c0e <unknown>
#12 0x55c8c92d7610 <unknown>
#13 0x55c8c92f5c23 <unknown>
#14 0x55c8c92c9545 <unknown>
#15 0x55c8c93166a8 <unknown>
#16 0x55c8c9316836 <unknown>
#17 0x55c8c9331d13 <unknown>
#18 0x7f98955d0609 start_thread

Then when I tried to run it again, I couldn't anymore. Could you help? Thank you!

Traceback (most recent call last):
  File "/local/home/asvz-bot/src/asvz_bot.py", line 606, in <module>
    main()
  File "/local/home/asvz-bot/src/asvz_bot.py", line 587, in main
    enroller = AsvzEnroller(chromedriver, lesson_url, creds)
  File "/local/home/asvz-bot/src/asvz_bot.py", line 253, in __init__
    self.__get_enrollment_and_start_time()
  File "/local/home/asvz-bot/src/asvz_bot.py", line 338, in __get_enrollment_and_start_time
    enrollment_interval_raw.get_attribute("innerHTML")
IndexError: list index out of range

Credentials

Sorry I am a programming noob. Where do I save it locally (where is .asvz-bot.json). Also does the program run on repl.it?
Thank you!

Filter recurrent lessons by needed filters

If to find this weeks lesson only the weekday, location and sport_id are needed to return only one possible option then other variables like trainer are not required.

TimeoutException for Login

Hi, I wanted to try the script myself yesterday. Because I run Chrome 119, the script did not work out of the box. So, I updated the WebDriver myself to a compatible one. But now there is a new problem, and I do not know how to fix it. As soon as I try to enroll in a lesson, it seems that the login button is not found, which I think is odd because the name of the object is still the same. So, I think it has something to do with Selenium not being able to interact with the website, but I do not know how to fix this.

2023-11-21 10:29:49 INFO     Checking login credentials

DevTools listening on ws://127.0.0.1:55511/devtools/browser/7f950da7-d6cb-401d-afbb-5bfaa26dee22
[1121/102956.204:INFO:CONSOLE(1)] "WARNING: AuthGuard should be implemented for this route:  https://schalter.asvz.ch/tn/lessons/558486", source: https://schalter.asvz.ch/tn/main.b9c8419c543486bf.js (1)
[1121/102956.206:INFO:CONSOLE(1)] "ERROR [object Object]", source: https://schalter.asvz.ch/tn/main.b9c8419c543486bf.js (1)
2023-11-21 10:29:56 INFO     Login to 'Universität Zürich'
Traceback (most recent call last):
  File "C:\Users\ASVZ_Bot\src\asvz_bot.py", line 613, in <module>
    main()
  File "C:\Users\ASVZ_Bot\src\asvz_bot.py", line 609, in main
    enroller.enroll()
  File "C:\Users\ASVZ_Bot\src\asvz_bot.py", line 284, in enroll
    self.__organisation_login(driver)
  File "C:\Users\ASVZ_Bot\src\asvz_bot.py", line 437, in __organisation_login
    WebDriverWait(driver, 20).until(
  File "C:\UsersAppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\support\wait.py", line 95, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.