【发布时间】:2023-03-23 08:23:02
【问题描述】:
Unirest 与 python3 不兼容,这是 mashape API 在 python 项目中使用的库。
我决定使用 python 请求库来发出 POST 请求,但我收到 400 HTTP 错误。一切对我来说都很好,但我不知道我做错了什么。
url = "https://japerk-text-processing.p.mashape.com/sentiment/"
myHeaders={
"X-Mashape-Key": mashape_key,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
}
myParams={
"language": "english",
"text": tweet_text
}
r = requests.post(url, headers=myHeaders, params=myParams)
print(r)
【问题讨论】:
标签: python-3.x python-requests text-processing mashape