【发布时间】:2016-12-30 13:21:25
【问题描述】:
我正在尝试从Adidas 的 API 端点获取数据。 当我从浏览器访问这个 url 时,我能够得到响应。 但是当我使用'wget'访问它时,我得到一个错误:
错误 400:错误请求
当我使用 python 访问它时,我得到一个错误:
{"code":1,"type":"error","message":"无效的语言环境格式:*"}
我无法深入了解这背后的原因。我也检查了请求标头信息,但我无法得出结论。
我遗漏了一些对其他人来说必须非常明显的东西,所以如果你知道,请告诉我。
我的 python 代码是一个使用 requests 模块的简单请求:
import requests
url = 'https://shop.adidas.co.in/gateway/catalog/api/page/ADIDAS_IN/kids-products/get?_=1483101382714'
try :
request = requests.get(url)
print request.url
print request.text
except Exception as exp :
print exp
【问题讨论】:
标签: python api python-requests