Skip to content

rabahdj2002/PythonAnywhere-Auto-Refresher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 PythonAnywhere Auto-Refresher

Python 3.7+ Selenium Status License: MIT

Never let your free PythonAnywhere web app expire again.

Tired of logging in manually every three months just to click one button? This intelligent automation bot handles the heavy lifting for you. It monitors your expiration dates locally and stealthily logs in to extend your app's life right before it goes offline. Set it, forget it, and keep your projects running forever.


✨ Why Use This?

This isn't just a "dumb" clicking script. It's smart engineering.

  • 🧠 Intelligent Scheduling: It's efficient. It checks a local JSON database first and only launches the browser when absolutely necessary (e.g., less than 7 days remaining).
  • 🥷 Stealth Mode Activated: Engineered with specific headers and JavaScript injection to bypass standard bot detection (like 403 Forbidden errors).
  • ⚡ Blazing Fast: Turbo-charged performance. It blocks heavy images and uses "eager loading" strategies to click that button in seconds without waiting for the full page to render.
  • 🔄 Auto-Healing Database: It doesn't just click; it verifies. After renewal, it scrapes the new future expiry date from the dashboard and updates your local config automatically.
  • 📜 Robust Logging: Keeps detailed daily logs for peace of mind and automatically cleans up old history to save space.

✅ Prerequisites

Before you begin, ensure you have the following ready:

  • 🐍 Python 3.7+ installed.
  • 🌐 Google Chrome (latest stable version).
  • 📦 pip (Python package manager).

🛠️ Quick Start Guide

Get up and running in 3 easy steps.

1️⃣ Clone & Install Dependencies

# Clone the project on your device
git clone https://github.com/rabahdj2002/PythonAnywhere-Auto-Refresher.git

# Cd to the working folder
cd pythonanywhere-refresher

# Install required Python packages
pip install selenium webdriver-manager

2️⃣ Configure Your Credentials (websites.json)

Create a websites.json file in the root directory.

💡 Pro Tip: Don't know your current expiry date? Just use an old date like "2000-01-01". The bot will detect it as expired, run the renewal immediately, and fix the date for you!

[
    {
        "username": "your_pa_username",
        "password": "your_pa_password",
        "expiry_date": "2000-01-01"
    },
    {
        "username": "second_account_user",
        "password": "second_password",
        "expiry_date": "2025-12-31"
    }
]

3️⃣ Tweak Settings (params.json)

Create a params.json file to control the bot's behavior.

{
    "threshold_days": 7,
    "loop_interval_seconds": 86400,
    "headless_mode": true
}
  • threshold_days: Renew if the site expires in less than this many days.
  • loop_interval_seconds: How often to check (86400 seconds = 24 hours).
  • headless_mode: Set true for invisible background running, or false to watch the browser work.

🚀 Run It!

Fire up the script and let it do its magic.

python smart_renewer.py

The script will enter a continuous loop, checking your local database daily and only launching Chrome when action is required.


Built with ❤️ and Python.

About

PythonAnywhere Auto Refresher

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages