Discover Local TooGoodToGo Magic Boxes
Every day, delicious, fresh food goes to waste at cafes, restaurants, hotels, shops and supermarkets - just because it hasn’t sold in time. Too Good To Go lets you rescue a Magic Bag of this food so it gets eaten instead of wasted. You won’t know exactly what’s in your order until you pick it up - it’s all part of the surprise. Great food at great prices, served with a side of environmental kudos.
That's just the blurb from the website. Here's how to grab local info with python...
pip install tgtg
from tgtg import TgtgClient client = TgtgClient(email='XXXX', password='XXXX') def get_available_food(latitude, longitude, radius): items = client.get_items( favorites_only=False, with_stock_only=True, latitude=latitude, longitude=-longitude, radius=radius ) for item in items: # print(vars(item)) name = item['store']['store_name'] address = item['store']['store_location']['address']['address_line'] category = item['item']['item_category'] info = item['item']['description'] available = item['items_available'] pickup_start = item['pickup_interval']['start'] pickup_end = item['pickup_interval']['end'] print(name) print(address) print(category) print(info) print(available) print(pickup_start) print(pickup_end) get_available_food(54.982830, -1.692130, 10)
Go forth and list the available magic boxes in your area. Enjoy your cheap food and groceries.
Thanks for reading. x