Let's write an application which uses the Zomato api https://developers.zomato.com/api to provide access to local area restaurants.
The basic gist of the application will be:
You should try to implement the following function. I suggest taking a bottom-up problem solving approach, first writing the function, testing it, and then finally using them in the main program. Remember good functions should do one thing well and have data inputs and outputs. They should be immutable, meaning the function does not change data but instead it returns the data back to the caller.
def search_area(zomato_key, city_id, keywords):
'''
returns a list of restaurants in the city_id matching keywords
return on success: {'status' : 'ok', 'message' : 'ok', 'restaurants' : restaurants }
return on failure: {'status' : 'error', 'message' : 'Reason for failure.', 'restaurants' : None }
'''
In [ ]:
import folium
import requests
from IPython.display import display
zomato_key = 'putYourKeyHere'
city_id = 988 #city_id of Syracuse, New York')
def search_area(zomato_key, city_id, keywords):
'''
returns a list of restaurants in the city_id matching keywords
return on success: {'status' : 'ok', 'message' : 'ok', 'restaurants' : restaurants }
return on failure: {'status' : 'error', 'message' : 'Reason for failure.', 'restaurants' : None }
'''
# TODO