我想在我的Python脚本中集成Zomato的{{1}}。
我知道Python中的基本编程,但对于API集成,我想知道
有哪些可行的选择?
答案 0 :(得分:1)
您可以开始使用Python的requests
模块。
获取类别列表的快速示例:
import requests
domain = "https://developers.zomato.com/api/v2.1"
headers = {'user-key': 'your_api_key_here'}
response = requests.get("{}/categories".format(domain), headers=headers).json()
for category in response["categories"]:
print(category)
这将输出如下内容:
{"categories": {"id": 1, "name": "Delivery"}}
{"categories": {"id": 2, "name": "Dine-out"}}
{"categories": {"id": 3, "name": "Nightlife"}}
{"categories": {"id": 4, "name": "Catching-up"}}
{"categories": {"id": 5, "name": "Takeaway"}}
# etc...
requests
can be found here.
答案 1 :(得分:0)
你的问题可能过于宽泛,不属于这个答案的范围,但我会尽我所能。
使用cURL使用GET / POST请求将相应的JSON数据发送到相应的端点(API网址+' / restaurant')。
< / LI>所有这些链接都将为您提供大量信息,以帮助您了解如何使用Zomato API完全满足您的需求。您可以做的最好的事情是自己了解HTTP请求的工作方式,然后按照这些链接开始。