A high-speed, cached stock checker for the Raspberry PI Zero through screen-scraping.
Help is welcome, but my time is limited so if you have a suggestion, enhancement or bug fix then please raise an issue to begin a conversation.
Once an issue is open we can can talk about the proposed change in the open. Once we've figured out what needs to be done then you can go ahead and raise a PR and it's very likely to get merged.
Using latest version of Docker and docker-compose:
$ git clone https://github.com/alexellis/pi_zero_stock
$ docker-compose up -d
npm install
in stock_fetch and web foldersredis-server
npm start
in both folders.Set up a hosts entry in /etc/hosts for redis to localhost, or set the environmental variable 'REDIS' to localhost before starting any of the nodes processes.
I've implemented endpoints for the following stores:
UK-based
US-based
To extend the code and add a new endpoint look at the stock_fetch
project and add a new file under the fetch
folder. This also needs to be updated in the entrypoint of stock_fetch
.
curl http://localhost:3000/stock/pimoroni/
curl http://localhost:3000/stock/pisupply/
curl http://localhost:3000/stock/pihut/
Access the following:
[x] Must have - hardening for failures during scrape
[x] Should have - total stock numbers for any Raspberry PI bundles/products by store.
[x] Should have - (Static site) Angular 1.x (via CDN) for binding stock results.
[ ] Should have - Switch to pm2 for the node processes
[x] Should have - coloured bootstrap wells or pills for in/out of stock.
[ ] Could have - web hooks (posting to Twitter)
[x] Could have - show stock for other suppliers. (adafruit)
[ ] Could have - show stock units for individual SKUs, rather than (or in addition to) just one total-per-shop