This Python script is designed to automate the process of checking availability on the website Stych.fr and sends an email notification if availability is found. The script uses Selenium for web automation, BeautifulSoup for parsing HTML, and the smtplib
module to send email notifications.
- Automated Login: Logs into the Stych.fr website using Selenium.
- Availability Check: Navigates to the target page and checks for availability.
- Email Notifications: Sends an email notification if availability is found.
- Scheduled Execution: The script is scheduled to run between 8 AM and 8 PM every 30 minutes.
Before running the script, ensure you have the following installed:
- Python 3.x
requests
module:pip install requests
beautifulsoup4
module:pip install beautifulsoup4
schedule
module:pip install schedule
selenium
module:pip install selenium
- ChromeDriver: Download ChromeDriver compatible with your Chrome browser version.
-
Install Python Dependencies: Run the following command to install the necessary Python packages:
pip install requests beautifulsoup4 schedule selenium
-
Download and Install ChromeDriver: Download the ChromeDriver from the official website and ensure it's in your system's PATH or specify the path in the script.
-
Configure Email Notifications: Update the
notify_user
function in the script with your Gmail address and an app password. To generate an app password, follow the instructions at Google Account Security.server.login("[email protected]", "your_app_password")
-
Update Login Credentials: Replace the placeholder credentials in the script with your Stych.fr login information:
username_field.send_keys("[email protected]") password_field.send_keys("your_password")
-
Run the Script: Execute the script by running:
python script_name.py
-
Automated Execution: The script will automatically check the availability every 30 minutes between 8 AM and 8 PM. If an availability is found, an email will be sent to the specified recipients.
-
Change the Frequency: To change the frequency of checks, modify the line:
schedule.every(30).minutes.do(job)
You can adjust the interval as needed.
-
Update Email Recipients: Add or change the recipients of the email notification by updating the
recipients
list:recipients = ["[email protected]", "[email protected]"]
- Ensure that the credentials and app passwords are kept secure and not shared publicly.
- The script is configured to run in a headless mode, which means it will not open a visible browser window.
- WebDriver Errors: Ensure that your ChromeDriver version matches your installed version of Chrome.
- Login Issues: Double-check your Stych.fr login credentials.
- Email Delivery Issues: Verify that you have correctly set up the Gmail app password and that your email settings allow for less secure apps or app passwords.
This project is open-source and available under the MIT License.