I’ve been using CellarTracker to track our wine inventory and make comments on the wines we drink. I’ve been happy with it – it’s a lot easier to use than my previous technique, a spreadsheet. And it’s nice to see comments from other users when we’re considering a new wine.
We keep the “ready” wines in a little wine refrigerator that holds 25 bottles; everything else is in the wine closet. When the refrigerator is empty, I use CellarTracker’s “ready to drink” report to decide what to move to the refrigerator. Unfortunately, the report tells me which wines to move, but not where to find them – that requires following a link to another report for each and every bottle. That’s a pain.
Instead, I’ve been exporting the data about all the wines in inventory to a spreadsheet, then running a small Python program that sorts them and creates a moving list. It’s easy, but a little awkward, because I have to log into the site and do the export from a browser.
Today was wine-moving day, and I decided I could simplify the process. My first thought was to figure out how to read the cookies from the browser and use them with the Python Requests module to get the data. I even found a module that reads the cookies – but it doesn’t work with Safari. There is a program that takes Safari’s binary cookies and creates a plain-text version, but I’d have to parse its output and this way lies madness.
If there were an API to CellarTracker’s data, life would be easy. It’s on their roadmap, and it’s been there for at least ten years. I don’t think it’s their top priority.
But searching for “CellarTracker API Python” led me to the CellarTracker package on GitHub which lets me get the inventory into a Python list. I replaced the code I had to parse the CSV file that I manually downloaded with a call to the package, and I was done!
The wine refrigerator is full again. Life is good.