{"id":26933265,"url":"https://github.com/sharadbhat/zomatopy","last_synced_at":"2025-04-02T09:18:18.022Z","repository":{"id":54766877,"uuid":"99603205","full_name":"sharadbhat/Zomatopy","owner":"sharadbhat","description":"A Python wrapper for the Zomato API.","archived":false,"fork":false,"pushed_at":"2021-01-30T17:36:08.000Z","size":20,"stargazers_count":19,"open_issues_count":4,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T17:51:25.924Z","etag":null,"topics":["python","python-wrapper","zomato-api"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/Zomatopy","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharadbhat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-07T17:32:45.000Z","updated_at":"2024-11-24T11:15:28.000Z","dependencies_parsed_at":"2022-08-14T02:10:43.785Z","dependency_job_id":null,"html_url":"https://github.com/sharadbhat/Zomatopy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharadbhat%2FZomatopy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharadbhat%2FZomatopy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharadbhat%2FZomatopy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharadbhat%2FZomatopy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharadbhat","download_url":"https://codeload.github.com/sharadbhat/Zomatopy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246785474,"owners_count":20833498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-wrapper","zomato-api"],"created_at":"2025-04-02T09:18:17.419Z","updated_at":"2025-04-02T09:18:18.011Z","avatar_url":"https://github.com/sharadbhat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zomatopy\nA Python wrapper for the Zomato API v2.1\n\n## Installation\n\n```bash\npip install zomatopy\n```\nOr download the source code from [here](http://github.com/sharadbhat/Zomatopy), and then just install the package using\n\n```bash\npython setup.py install\n```\n\n\n## Getting Started\n### Python Version\nThis wrapper was written for Python 3 and might not work well with Python 2.\n\n### Adding Zomatopy to your application\nFor use with only user based authentication we can create the following configuration:\n\n```python\nimport zomatopy\n\nconfig={\n  \"user_key\":\"ZOMATO_API_KEY\"\n}\n    \nzomato = zomatopy.initialize_app(config)\n```\n## Methods\n### Common\n#### Getting all Category IDs and the category names\n- Takes no inputs.\n- Returns a dictionary of Category IDs and corresponding Category Names.\n\n```python\ncategory_dictionary = zomato.get_categories()\n```\n\n#### Getting ID for a particular city\n- Takes City Name as input.\n- Returns the City ID of the city.\n- Can raise ```InvalidCityName``` exception.\n\n```python\n# city_name must be a string without numbers or special characters.\n\ncity_ID = zomato.get_city_ID(city_name)\n```\n\n#### Getting Name for a particular City ID\n- Takes City ID as input.\n- Returns name of the city with that ID.\n- Can raise ```InvalidCityId``` exception.\n\n```python\n# city_ID must be an integer.\n\ncity_name = zomato.get_city_name(city_ID)\n```\n\n#### Getting the Zomato Collections in a city\n- Takes City ID and number of collections as input.\n- If number of collections is not specified, returns all Zomato Collections.\n- Returns a dictionary of Collection Name and Collection URL.\n- Can raise ```InvalidCityId``` and ```LimitNotInteger``` exceptions.\n\n```python\n# city_ID must be an integer.\n# limit must be an integer.\n\n# Returns all the Zomato Collections in a city\ncollections_dictionary = zomato.get_collections(city_ID)\n\n# Returns 'limit' number of collections.\ncollections_dictionary = zomato.get_collections(city_ID, limit=number_of_collections)\n```\n\n#### Getting the cuisines in a city\n- Takes City ID as input.\n- Returns a dictionary of Cuisine ID and corresponding Cuisine Names.\n- Can raise ```InvalidCityId``` exception.\n\n```python\n# city_ID must be an integer.\n\ncuisine_dictionary = get_cuisines(city_ID)\n```\n\n#### Getting all establishment types in a city.\n- Takes City ID as input.\n- Returns a dictionary of Establishment Type ID and corresponding Establishment Type Name.\n- Can raise ```InvalidCityId``` exception.\n\n```python\n# city_ID must be an integer.\n\nestablishment_types_dictionary = get_establishment_types(city_ID)\n```\n### Restaurant\n\n#### Getting the nearby restaurants\n- Takes Latitude and Longitude as inputs.\n- Returns a dictionary of Restaurant IDs and their corresponding Zomato URLs.\n- Can raise ```InvalidLatitudeOrLongitude``` exception.\n\n```python\n# latitude and longitude must be float or string representation of a float.\n\nrestaurant_dictionary = get_nearby_restaurants(latitude, longitude)\n```\n\n#### Getting the details of a particular restaurant\n- Takes Restaurant ID as input.\n- Returns a dictionary of restaurant details.\n- Can raise a ```InvalidRestaurantId``` exception.\n\n```python\n# restaurant_ID must be an integer.\n\nrestaurant_details = get_restaurant(restaurant_ID)\n\n# restaurant_details.name gives the restaurant name.\n# restaurant_details.url gives the restaurant Zomato URL.\n# restaurant_details.location gives the restaurant location.\n# restaurant_details.city gives the restaurant city name.\n# restaurant_details.city_ID gives the restaurant city's ID.\n# restaurant_details.user_rating gives the restaurant rating.\n```\n\n#### Searching restaurants based on query, latitude/longitude and/or cuisine IDs\n- Takes either query, latitude and longitude or cuisine as input (at least one is necessary).\n- limit can be specified to give only those many restaurant results (limit=5 by default).\n- Returns a list of Restaurant IDs.\n- Can raise a ```LimitNotInteger``` exception.\n\n```python\n# latitude and longitude must be float or string representation of a float.\n# multiple cuisine IDs can be specified by separating with commas. Must be a string.\n\nrestaurant_list = restaurant_search(query=\"Buffet\", cuisines=\"1, 25\")\n```\n## Exceptions\n\n#### InvalidKey\n- If the key is not a valid Zomato API Key.\n\n```\nValueError: InvalidKey\n```\n#### InvalidCityId\n- If the City ID contains an alphabet or special characters.\n- If the City ID is not present in the Zomato database.\n\n```\nValueError: InvalidCityId\n```\n#### InvalidCityName\n- If the City Name consists of numbers or special characters.\n- If the City Name is not present in the Zomato database.\n\n```\nValueError: InvalidCityName\n```\n#### InvalidRestaurantId\n- If the Restaurant ID consists of alphabets or special characters.\n- If the Restaurant ID is not present in the Zomato database.\n\n```\nValueError: InvalidRestaurantId\n```\n#### InvalidLatitudeOrLongitude\n- If the latitude or longitude value provided in not a number or string representation of a number.\n\n```\nValueError: InvalidLatitudeOrLongitude\n```\n#### LimitNotInteger\n- If the limit parameter provided for the ```get_collections()``` or ```restaurant_search()``` methods is not an integer.\n\n```\nValueError: LimitNotInteger\n```\n#### ApiLimitExceeded\n- If the daily call limit of the API Key is exceeded.\n\n```\nException: ApiLimitExceeded\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharadbhat%2Fzomatopy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharadbhat%2Fzomatopy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharadbhat%2Fzomatopy/lists"}