import requests
url=‘https://fanyi.baidu.com/sug‘
data={
‘kw‘:‘people‘
}
headers={
‘User-agent‘:‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36‘
}
response=requests.post(url=url,data=data,headers=headers)
page_text=response.json()
print(page_text)
# with open(‘sougou.html‘,‘w‘,encoding=‘utf-8‘) as fp:
# fp.write(page_text)
原文:https://www.cnblogs.com/sjj123/p/15070421.html