I’ve been hacking code for many years now but have never considered myself a real software developer, despite having built apps in a variety of languages. Over the last couple of years I’ve enjoyed hacking away at Python and have created many websites, apps, and scripts but never really published or publicised them.
I just published my first GitHub repository with a Python script to retrieve the latest spot price from the Flick website for our account. Flick has promised to release an API for years but have yet to deliver anything, so my script uses Requests and BeautifulSoup to scrape the spot price from the Flick dashboard.
When first run, the script prompts for your credentials and saves them to a file on your disk so that the script can run without interaction in the future. And when you first successfully authenticate it will save your cookies to a file to avoid having to re-authenticate each time it runs. The spot price on the Flick website updates every half hour, so the script will save the current spot price to disk as well as the end date time which indicates when the next website update will be. Then the script can run as often as you like but it will only ever go to the website once while that price is valid.
I created the script so that I could retrieve the spot price and integrate it into my HomeAssistant installation. I plan to do further automation based on the current spot price but for now I’m just sending myself a Telegram notification when the price changes.