【发布时间】:2016-03-06 10:54:00
【问题描述】:
Zomato 是最受欢迎的餐厅搜索引擎之一,提供免费的 api 服务...
如果在api请求中使用curl,效果很好;
curl -X GET --header "Accept: application/json" --header "user_key: MY_API_KEY_HERE" "https://developers.zomato.com/api/v2.1/geocode?lat=41.10867962215988&lon=29.01834726333618"
但是使用了 Python 的 requests 库,它不起作用。当我执行下面的代码时;
import requests
r = requests.get("https://developers.zomato.com/api/v2.1/geocode?lat=41.10867962215988&lon=29.01834726333618", headers={"user_key": "MY_API_KEY_HERE", "Accept": "application/json"});
解释器返回以下错误;
requests.exceptions.ProxyError: Cannot connect to proxy. Socket error: Tunnel connection failed: 403 Forbidden.
通过pyCurl 库进行了几次尝试,但不幸的是结果相同; 403 Forbidden
我该如何解决这个问题?
【问题讨论】:
-
即使我得到 500 错误。请帮忙
标签: python json python-requests pycurl zomato-api