马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
得到的request URL总是不对,html打印出来总是error:50,换了好几个浏览器都不行
import urllib.request as u
import urllib.parse
import json
url = 'http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule&sessionFrom=dict2.index'
data = {}
data['i'] = 'yes,i do'
data['from'] = 'AUTO'
data['to'] = 'AUTO'
data['smartresult'] = 'dict'
data['client'] = 'fanyideskweb'
data['salt'] = '1494777765661'
data['sign'] = 'b124ce065c223c0d7b5e5330cda2572a'
data['doctype'] = 'json'
data['version'] = '2.1'
data['keyfrom']='fanyi.web'
data['action']='FY_BY_CLICKBUTTON'
data['typoResult']='true'
data = urllib.parse.urlencode(data).encode('utf-8')
response = u.urlopen(url,data)
html = response.read().decode('utf-8')
print(html)
|