Quickly hacked up a REST API, which parses Sainsbury's top tipples page behind the scenes and returns JSON data with regards to the item's name, price and the amount you save with the given offer.
- Python 3.6
- Beautiful Soup 4 (V - 4.6.3)
- Flask (V - 1.0.2)
- Zappa (V - 0.46.2)
In order to run the REST API locally, you can carry out the following steps:
- git clone https://github.com/stefankaransingh/sainsbury_top_tipples.git
- cd file-path/sainsbury_top_tipples
- pip intstall -r requiremnts.txt
- FLASK_APP=main.py flask run
Currently, these are the following REST APIs, which are hosted on AWS Lambda.
The below URL allows you to make a GET
request and retrieve all the top tipples offers from page 1. The url also accepts an argument called thresholdprice
, that when specified, returns all the offers below the thresholdprice
.
- URL : https://zs9mxnjuw1.execute-api.us-west-2.amazonaws.com/dev/getoffers
- Example: https://zs9mxnjuw1.execute-api.us-west-2.amazonaws.com/dev/getoffers?thresholdprice=7
- This retrieves all the offers below the price of £7.
The below URL allows you to make a GET
request and retrieve all the top tipples offers where you can save most.
- Improve on the APIs to retrieve not just the offers from page 1, but also from the remaining pages.
- Build unit test cases for each of the end points.