Automatically renew your PythonAnywhere free web app every 15 days using GitHub Actionsβnever let your app expire again!
Main App Demo | Weather Monitoring System
- Overview
- Features
- Tech Stack
- Architecture
- Getting Started
- Project Structure
- Configuration
- Workflow Logs
- Related Repositories
- Troubleshooting
- Contributing
- License
PythonAnywhere free tier apps expire after 3 months 1 month of inactivity (updated Jan 2026). This bot automatically renews your web app by logging into PythonAnywhere and clicking the "Extend" button every 15 days via GitHub Actions.
Combined with the Weather-Monitoring-System auto-deployment webhook, this creates a completely hands-off hosting solution that stays alive indefinitely on the free tier.
Day 1: Deploy app β
Day 30: App expires β
Day 31: Users see error page π’
Day 32: Manual renewal... again π€
Day 1: Deploy app β
Day 15: Bot auto-renews β
Day 30: Bot auto-renews β
...forever! π
- Scheduled renewal on the 1st and 15th of every month (04:00 UTC / 09:30 IST)
- Manual trigger available from GitHub Actions tab
- Automatic log commits prevent GitHub from disabling the workflow
- Complete audit trail in
.github/logs/workflow_runs.log - Clear SUCCESS β or FAILED β status indicators
- Timestamps, run IDs, and trigger source for debugging
- Credentials stored as encrypted GitHub Secrets
- Never exposed in logs or code
- HTTPS for all PythonAnywhere connections
| Component | Technologies |
|---|---|
| Language | Python 3.9+ |
| Libraries | requests, beautifulsoup4, python-dotenv |
| CI/CD | GitHub Actions |
| Target | PythonAnywhere Free Tier |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FULLY AUTOMATED PYTHONANYWHERE HOSTING β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β GITHUB β β
β β β β
β β βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ β β
β β β Weather-Monitoring-System β β PythonAnywhere-Auto-Renew β β β
β β β β β β β β
β β β β’ Main application code β β β’ Renewal bot (this repo) β β β
β β β β’ Deployment endpoint β β β’ Runs 1st & 15th monthly β β β
β β β β’ Auto-deploys on push β β β’ Keeps app alive forever β β β
β β ββββββββββββββββ¬βββββββββββββββ ββββββββββββββββ¬βββββββββββββββ β β
β β β POST request β GitHub β β
β β β (/github-webhook) β Actions β β
β β βΌ βΌ β β
β ββββββββββββββββββββΌβββββββββββββββββββββββββββββββββΌβββββββββββββββββββ β
β β β β
β ββββββββββββββββββββΌβββββββββββββββββββββββββββββββββΌβββββββββββββββββββ β
β β PYTHONANYWHERE β β
β β β β
β β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β β
β β β Deployment Endpoint β β Auto-Renewal β β β
β β β β’ git pull β β β’ Extends app expiry β β β
β β β β’ pip install β β β’ Prevents shutdown β β β
β β β β’ Reload webapp β β β’ Zero maintenance β β β
β β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ β β
β β β β
β β https://tanishqmudaliar.pythonanywhere.com β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β Push code β Instantly live β Stays alive forever β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- GitHub Actions runs the workflow on the 1st and 15th of each month
- Python script logs into PythonAnywhere using your credentials
- Script navigates to the web apps dashboard
- If an "Extend" button is found, it clicks to renew
- Result (success/failure) is logged and committed
- Regular commits keep the workflow from being auto-disabled
- PythonAnywhere free account with a web app
- GitHub account
- 5 minutes of setup time
git clone https://github.com/tanishqmudaliar/PythonAnywhere-Auto-Renew.git
cd PythonAnywhere-Auto-RenewOr click "Use this template" on GitHub.
- Go to your repository β Settings β Secrets and variables β Actions
- Click New repository secret and add:
| Secret Name | Value |
|---|---|
PA_USERNAME |
Your PythonAnywhere username |
PA_PASSWORD |
Your PythonAnywhere password |
- Go to Settings β Actions β General
- Under Workflow permissions, select "Read and write permissions"
- Check "Allow GitHub Actions to create and approve pull requests"
- Click Save
- Go to the Actions tab
- Click Auto-Renew PythonAnywhere
- Click Run workflow β Run workflow
- Verify logs show "β Login successful"
-
Install dependencies
pip install -r requirements.txt
-
Create
.envfilePA_USERNAME=your_username PA_PASSWORD=your_password
-
Run the script
python renew_python_anywhere.py
Expected output:
π Logging in as your_username...
β
Login successful
π Checking dashboard...
βΉοΈ No extend button found.
This usually means your app doesn't need renewal yet.
PythonAnywhere-Auto-Renew/
βββ .github/
β βββ workflows/
β β βββ renew.yml # GitHub Actions workflow
β βββ logs/
β βββ workflow_runs.log # Auto-generated run history
βββ renew_python_anywhere.py # Main renewal script
βββ requirements.txt # Python dependencies
βββ .env # Local credentials (not in git)
βββ .gitignore # Git ignore rules
βββ LICENSE # MIT License
βββ README.md # Project documentation
| Variable | Description | Required |
|---|---|---|
PA_USERNAME |
PythonAnywhere username | Yes |
PA_PASSWORD |
PythonAnywhere password | Yes |
Edit .github/workflows/renew.yml to change the cron schedule:
# Current: 1st and 15th at 04:00 UTC
- cron: '0 4 1,15 * *'
# Alternative: Every Monday at noon UTC
- cron: '0 12 * * 1'
# Alternative: Every 10 days
- cron: '0 4 1,11,21 * *'Every run is logged to .github/logs/workflow_runs.log:
========================================
Workflow Run: 2026-01-15 04:00:00 UTC
Status: SUCCESS β
Trigger: schedule
Repository: username/PythonAnywhere-Auto-Renew
Branch: main
Run ID: 123456789
Run Number: 5
========================================
========================================
Workflow Run: 2026-01-15 04:00:00 UTC
Status: FAILED β
Trigger: schedule
Repository: username/PythonAnywhere-Auto-Renew
Branch: main
Run ID: 123456790
Run Number: 6
Note: Check GitHub Actions logs for error details
========================================
| Repository | Purpose |
|---|---|
| Weather-Monitoring-System | Main weather app with auto-deployment webhook |
| PythonAnywhere-Auto-Renew | Keeps the app alive on free tier (this repo) |
Together, these repositories provide:
- Instant automated deployment on every push
- 24/7 uptime without manual intervention
- Zero-maintenance free-tier hosting
- Verify
PA_USERNAMEandPA_PASSWORDsecrets are correct - Try logging in manually to confirm credentials work
- Check if PythonAnywhere changed their login page
- This is normal, your app doesn't need renewal yet
- The button only appears when renewal is due
- Logged as SUCCESS β (not an error)
- GitHub disables inactive workflows after 60 days
- This bot commits logs every 15 days to prevent this
- Re-enable manually if needed, then run the workflow
- Check the GitHub Actions workflow run for detailed error logs
- Common causes: wrong credentials, PythonAnywhere site changes
- Workflow retries automatically on the next scheduled run
Contributions are welcome! Please feel free to submit pull requests or open issues.
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -m 'Add improvement') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
This project is open source and available under the MIT License.
Made with β€οΈ for PythonAnywhere users
Stop manually clicking that extend button. Automate it! π