PythonAnywhere Auto-Run is a Python automation script that manages Flask web apps hosted on PythonAnywhere. It automatically logs into your PythonAnywhere account, navigates to your web app dashboard, clicks the “Run until 3 months from today” button, and retrieves the expiry date of your web app.
The script also generates a step-by-step report and sends it via email, allowing you to monitor the process without manually checking the site.
- Automatic login to PythonAnywhere.
- Clicks "Run until 3 months from today" to keep the web app active.
- Extracts and reports the web app expiry date.
- Sends email notifications summarizing each step and any errors.
- Uses Selenium WebDriver for browser automation.
- Handles errors gracefully with detailed logs.
-
Clone the repository to your local machine.
-
Install the required Python packages using
pip install -r requirements.txt
. -
Create a
.env
file in the project root and add your credentials:USER_NAME = your_pythonanywhere_username USER_PASS = your_pythonanywhere_password EMAIL_SENDER = your_email@gmail.com EMAIL_PASS = your_email_password EMAIL_RECEIVER = receiver_email@gmail.com
-
Ensure you have Chrome installed and either use a local ChromeDriver path or let the script download it automatically.
-
Open a terminal or Git Bash.
-
Navigate to the project folder.
-
Run the script using:
python your_script_name.py
-
Check your email for a detailed report of the automation process.
- Recommended to run the script periodically to prevent your web app from expiring.
- Uses WebDriverWait to handle slow internet connections instead of fixed sleep intervals.
- All steps are logged and included in the email report.