Noliangperson
2022-07-15 17:25
采纳率: 50%
浏览 39

python 中post请求返回值是500

python 中 post请求 code 返回值是500

#url:https://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule
import requests

import json

url = 'https://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule%27
headers = {
"Content-Type":"application/json",
"Host": "fanyi.youdao.com",
"Origin": "https://fanyi.youdao.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.49"
}
data = {
'i': '你好中国',
'from': 'zh-CHS',
'to': 'en',
'smartresult': 'dict',
'client': 'fanyideskweb',
'salt': '16578734852847',

'lts': '1657873485284',
'bv': '99f65dce5b9aecb82d860e184d44cd9c',
'doctype': 'json',
'version': '2.1',
'keyfrom': 'fanyi.web',
'action': 'FY_BY_REALTlME'
}
res = requests.post(url=url,data=data,headers=headers)
code = res.status_code
print(code)
#print(res.json())
#if code== 200:

print(res.content)

500

我把translate_o换成translate
url = 'https://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule%27
还是不行,不知道问题出在哪里了

2条回答 默认 最新

相关推荐 更多相似问题