用Python-get方法向頁(yè)面發(fā)起請(qǐng)求,參數(shù)傳不進(jìn)去是怎么回事
#-*-coding:utf-8-*-
import urllib
import urllib2
url = 'http://cms.partner.wht.cn/login/login.do'
#定義數(shù)據(jù)
data = {}
data['adminName'] = 'admin'
data['adminPassword'] = '96e79218965eb72c92a549dd5a330112'
#對(duì)請(qǐng)求數(shù)據(jù)進(jìn)行編碼
data = urllib.urlencode(data)
#拼接地址跟數(shù)據(jù)
requst = url + '?' + data
#打開(kāi)請(qǐng)求,獲取對(duì)象
requstreponse = urllib2.urlopen(requst)
#讀取服務(wù)器返回的數(shù)據(jù)
reponsestr = requstreponse.read()
#打印數(shù)據(jù)
reponsestr = reponsestr.decode('utf-8')
print reponsestr
2017-12-01