A robust, containerized service that checks Vale of White Horse bin collection schedule and sends reminders through multiple notification channels.
- Web Scraping: Retrieves bin collection information from Vale of White Horse Council website using UPRN
- Multi-Channel Notifications: Supports Discord webhooks, WhatsApp (via CallMeBot), and Email
- Scheduled Execution: Configurable cron-based scheduling with Docker container
- Containerized Deployment: Easy deployment with Docker and Docker Compose
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Docker β β Cron Scheduler β β Python Scriptsβ
β Container βββββΆβ (configurable) βββββΆβ β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Vale of White ββββββ Web Scraper β β Notification β
β Horse Council β β (BeautifulSoup) β β Services β
β Website β ββββββββββββββββββββ βββββββββββββββββββ
βββββββββββββββββββ β
βΌ
βββββββββββββββββββ
β Discord/WhatsAppβ
β /Email Delivery β
βββββββββββββββββββ
- Clone the repository:
git clone https://github.com/yourusername/bin-collection-reminder.git
cd bin-collection-reminder
- Configure environment variables:
cp env.template .env
# Edit .env with your settings (see Configuration section below)
- Deploy with Docker:
docker-compose up -d
- Monitor logs:
docker-compose logs -f
Variable | Description | Example |
---|---|---|
UPRN |
Your Unique Property Reference Number | 123456789 |
Variable | Description | Default | Example |
---|---|---|---|
CRON_SCHEDULE |
When to run the check (cron format) | 0 18 * * 1 |
0 9 * * 0,3 |
Variable | Description | Default | Example |
---|---|---|---|
DISCORD_ENABLED |
Enable Discord notifications | false |
true |
DISCORD_WEBHOOK |
Discord webhook URL | https://discord.com/api/webhooks/... |
Variable | Description | Default | Example |
---|---|---|---|
WHATSAPP_ENABLED |
Enable WhatsApp notifications | false |
true |
WHATSAPP_PHONE |
Phone number with country code | +1234567890 |
|
WHATSAPP_APIKEY |
CallMeBot API key | your-api-key |
Variable | Description | Default | Example |
---|---|---|---|
EMAIL_ENABLED |
Enable email notifications | false |
true |
EMAIL_SMTP_SERVER |
SMTP server address | smtp.gmail.com |
smtp.outlook.com |
EMAIL_SMTP_PORT |
SMTP server port | 587 |
465 |
EMAIL_SENDER |
Sender email address | sender@example.com |
|
EMAIL_PASSWORD |
Sender email password/app password | your-app-password |
|
EMAIL_RECIPIENT |
Recipient email address | recipient@example.com |
- HTTP Request: Makes authenticated request to Vale of White Horse Council website
- HTML Parsing: Uses BeautifulSoup to extract collection information from specific CSS classes
- Data Processing: Parses collection day, type, and special messages
- Error Handling: Gracefully handles network errors and parsing failures
- Message Formatting: Creates appropriate message based on collection data
- Multi-Channel Delivery: Sends to all enabled notification channels
- Error Reporting: Logs success/failure for each notification method
- Startup: Runs collection check immediately
- Cron Setup: Configures scheduled execution based on
CRON_SCHEDULE
- Continuous Operation: Runs in background with log monitoring
Your UPRN (Unique Property Reference Number) can be found by:
-
Council Website Method:
- Visit Vale of White Horse Council
- Search for your property in their bin collection service
- Look for the UPRN in the URL or page source
-
Alternative Methods:
- Check your council tax bill
- Use online UPRN lookup services
- Contact the council directly
bin-collection-reminder/
βββ π scripts/ # Main application code
β βββ bin_collection.py # Core scraping and orchestration
β βββ notifications.py # Multi-channel notification services
βββ π tests/ # Test suite
β βββ __init__.py # Test package initialization
β βββ test_beautifulsoup.py # HTML parsing tests
β βββ CLAUDE.md # AI assistant guidance
βββ π Dockerfile # Container definition
βββ π docker-compose.yml # Service orchestration
βββ π entrypoint.sh # Container startup script
βββ π requirements.txt # Python dependencies
βββ π env.template # Environment configuration template
βββ π .gitignore # Git ignore patterns
βββ π README.md # This documentation
# Install dependencies
pip install -r requirements.txt
# Run directly
python -m scripts.bin_collection
# Run tests
python -m pytest tests/
# Type checking
mypy scripts/
# Code formatting
black scripts/ tests/
- Type Hints: All functions have complete type annotations
- Error Handling: Comprehensive exception handling with timeouts
- Documentation: Docstrings with Args/Returns sections
- Imports: Organized (standard library β third-party β local)
- Formatting: 4-space indentation, 88-character line length
# Run all tests
python -m unittest discover tests/
# Run specific test
python -m unittest tests.test_beautifulsoup
# Run with coverage
python -m coverage run -m unittest discover tests/
python -m coverage report
- Endpoint:
https://eform.southoxon.gov.uk/ebase/BINZONE_DESKTOP.eb
- Authentication: Cookie-based with UPRN
- Rate Limiting: Built-in 10-second timeout
- Response Format: HTML with specific CSS classes
- Endpoint:
https://api.callmebot.com/whatsapp.php
- Authentication: API key required
- Setup: CallMeBot WhatsApp Guide
- Format: JSON payload with username customization
- Rate Limiting: Respects Discord's webhook limits
Container won't start:
# Check logs
docker-compose logs bin-collection-reminder
# Verify environment variables
docker-compose config
No notifications received:
# Check notification settings
docker exec bin-collection-reminder env | grep -E "(DISCORD|WHATSAPP|EMAIL)"
# Test manually
docker exec bin-collection-reminder python -m scripts.bin_collection
UPRN not working:
- Verify UPRN is correct (numeric, no spaces)
- Check Vale of White Horse Council website is accessible
- Try running script manually to see error messages
Enable verbose logging:
# Add to docker-compose.yml environment section
- DEBUG=true
Manual execution:
# Run script once
docker exec bin-collection-reminder python -m scripts.bin_collection
# Check cron logs
docker exec bin-collection-reminder tail -f /var/log/cron.log
- Environment Variables: Sensitive data stored in
.env
file (not committed) - Network Security: HTTPS requests with proper timeout handling
- Container Security: Minimal base image with only required packages
- Credential Management: Supports app passwords for email authentication
- Memory Usage: ~50MB container footprint
- Network: Single HTTP request per execution
- CPU: Minimal usage (only during scheduled runs)
- Storage: Logs rotate automatically
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature
- Follow code style: Use type hints, docstrings, and error handling
- Add tests: Include unit tests for new functionality
- Update documentation: Keep README and docstrings current
- Submit pull request: Include description of changes
# Clone your fork
git clone https://github.com/yourusername/bin-collection-reminder.git
# Install development dependencies
pip install -r requirements.txt
pip install pytest mypy black flake8
# Run quality checks
black scripts/ tests/
flake8 scripts/
mypy scripts/
python -m pytest tests/
This project is open source. Please check the repository for license details.
- Vale of White Horse Council: For providing accessible bin collection data
- CallMeBot: For free WhatsApp API service
- Discord: For webhook notification support
- Python Community: For excellent libraries (requests, BeautifulSoup, etc.)
- β Added comprehensive type hints
- β Improved error handling with timeouts
- β Enhanced documentation with architecture diagrams
- β Added unit tests for HTML parsing
- β Containerized deployment with Docker
- β Multi-channel notification support
- β Configurable scheduling via environment variables
- π Add more comprehensive test coverage
- π Implement retry logic for failed notifications
- π Add support for multiple UPRNs
- π Create web dashboard for configuration
- π Add Prometheus metrics for monitoring