The import requests, time
The from fake_useragent import UserAgent
If __name__=="__main__ ':
Values="yellow"
Salt=STR (int (time. Time () * 10000))
Ts=STR (int (time. Time () * 1000))
Url=r 'http://fanyi.youdao.com/translate? Smartresult=dict&smartresult=rule '
Data={
https://bbs.csdn.net/topics/'I' : values,
'salt' : salt,
'ts' : ts,
}
Headers={
"The user-agent" : UserAgent (). The random,
"Cookie", "OUTFOX_SEARCH_USER_ID=1585629883 @10.169.0.83; JSESSIONID=aaasiLb7l5T3e701hoibx; "
"DICT_UGC=be3af0da19b5c5e6aa4e17bd8d90b28a |; JSESSIONID=abcUuFgCD8qeDatKjoibx; "
"OUTFOX_SEARCH_USER_ID_NCOO=660044332.2332675; ___rl__test__cookies=% s "% ts,
The content-type: "application/json; Charset=utf-8 "
}
Request=requests. Post (url, data=https://bbs.csdn.net/topics/data, headers=headers, timeout=5)