This is a cron service, written in Python which will SMS you when the bins need taking out. It currently only has support for UK councils.
- Twilio account
- Sqlite3 database
When triggered, this service will iterate through all properties in the Sqlite3 database, and scrape the council website for those properties' bin collections. If there are bins to be collected the next day, the service will text the residents at that property.
A number of environment variables are needed to run this script.
BIN_VENV
base directory of the Python virtual environment for this projectACCOUNT_SID
Twilio Account IDAUTH_TOKEN
Twilio Auth tokenNUMBER
phone number that the texts will be sent fromDELAY_IN_DAYS
number of days before the collection that the texts should be sentDB_ADDRESS
path to the Sqlite3 db fileLOG_FILE
output log file
To run the service in test mode you can use the shell script provided.
./run.sh
This will not send out any SMS messages, but will print the message and recipient to STDOUT.
./run.sh live
This will run the service in the same way - but texts will be sent out to the residents of the properties which have bin collections.
This service has been written with extensibility in mind, so adding new councils should be very simple. See the CollectionScraper
class to understand what interfaces should be followed.
- Unit testing
- Asynchronous requests
- Run tests in deploy script