import urllib.request
import urllib.parse
url = 'https://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule' # 把 _o 去掉
data = {}
data['i'] = '我是你妈妈'
data['smartresult'] = 'dict'
data ['client'] = 'fanyideskweb'
data ['salt']='16508879090005'
data ['sign']= '67eada1d1767da800db1c0428a8483eb'
data ['lts']= '1650887909000'
data ['bv']= 'ac3968199d18b7367b2479d1f4938ac2'
data ['doctype']= 'json'
data ['version']= '2.1'
data ['keyfrom']= 'fanyi.web'
data ['action']=' FY_BY_REALTlME'
data ['from'] = 'AUTO'
data ['to']= 'AUTO'
data = urllib.parse.urlencode(data).encode('ascii')
response = urllib.request.urlopen(url , data)
html = response.read().decode() # 去掉 'ascii'
print(html)