Small Python script to scrape the Stockholm student housing queue SSSB, assisting with checking when new apartments have arrived and then smoothly notifiying via email.
The Selenium web driver has been used in order to scrape the SSSB webpage. This is the only non-Python dependency. Install it with the following command:
pip install -r requirements.txt
In order to send an email once new apartments arrive, an email server is required. This is implemented via three environment variables that you have to set, assuming the smtp.gmail.com
server is used:
export GMAIL_USER = "sender-email@gmail.com"
export GMAIL_PASSWORD = "sender-password"
export RECEIVING_USER = "receiver@email.com"
If you wish to use another SMTP-server of your choice you can change the server
variable in the sendMail(..)
function.
Once launched, the script will fetch data from SSSB every hour. This frequency can easily be changed by altering the parameter updateFrequencyInSeconds
, placed in main()
.
Observe that the trigger is based on the number of available apartments changing, and will thus include SSSB lowering the amount of available apartments as well - i.e. there will be a few false positives. However, most of the time SSSB releases a batch with new apartments, which will be captured correctly. We can not simply check if the new number is greater than the previous either, since our update frequency is not capturing every single object added/removed. This script will thus identify most events correctly, with no false negatives, and definitely be an assisting hand when searching for apartments via SSSB.
This project is licensed under the GNU License - see the LICENSE.md file for details.