def lambda_handler(event, context): try: response = Yelp_API(event).call_API() except RuntimeError as re: raise DatabaseError(re.message) print(response) if not response: raise DatabaseError("NoFoodException") return response # Echo back the first key value
def uploadAllFilter(self, category, term, os): offset = os while True: print("Offset: {}".format(offset)) params = { "term": term, "food_per_business": 10, "ll": "33.7175, -117.8311", # "limit": 20, "radius_filter": 40000, "category_filter": category, "sort": 1, "offset": offset } response = Yelp_API(params).call_API() print("Number of food: {}".format(len(response))) if len(response) == 0: break offset += 20 FoodUpload().uploadList(response)
from yelpApi import Yelp_API import pprint from foodUpload import FoodUpload #Test Parameters params = { # "term": "asian", "food_per_business": 1000, "ll": "33.9533, -117.3962", "limit": 20, "radius_filter": 40000, "category_filter": "chinese", "sort": 0, "offset": 0, } response = Yelp_API(params).call_API() print("Number of food: {}".format(len(response))) FoodUpload().uploadList(response) # pprint.pprint(response)
def lambda_handler(event, context): print(event) response = Yelp_API(event).call_API() print(response) return response # Echo back the first key value