import urllib.request
import urllib.parse
url = "https://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule"
data = {}
data['i'] = 'i love python'
data['from'] = 'AUTO'
data['to'] = 'AUTO'
data['smartresult'] = 'dict'
data['client'] = 'fanyideskweb'
data['salt'] = '16260996240444'
data['sign'] = '463117c612697bad2114f4258f015b75'
data['lts'] = '1626099624044'
data['bv'] = '5b3e307b66a6c075d525ed231dcc8dcd'
data['doctype'] = 'json'
data['version'] = '2.1'
data['keyfrom'] = 'fanyi.web'
data['action'] = 'FY_BY_REALTlME'
data = urllib.parse.urlencode(data).encode('utf-8')
response = urllib.request.urlopen(url, data)
content =response.read().decode('utf-8')
print(content)