Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.81 KB

File metadata and controls

48 lines (35 loc) · 1.81 KB

PythonAnywhere Auto-Run

Overview

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.

Features

  • 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.

Setup Instructions

  1. Clone the repository to your local machine.

  2. Install the required Python packages using pip install -r requirements.txt.

  3. 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
    
  4. Ensure you have Chrome installed and either use a local ChromeDriver path or let the script download it automatically.

Usage

  1. Open a terminal or Git Bash.

  2. Navigate to the project folder.

  3. Run the script using:

    python your_script_name.py
  4. Check your email for a detailed report of the automation process.

Notes

  • 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.