python get请求 url传参_用Python-get方法向页面发起请求,参数传不进去是怎么回事...
源自:4-1 接口測試工具-python-get接口實(shí)戰(zhàn)
用Python-get方法向頁面發(fā)起請求,參數(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'
#對請求數(shù)據(jù)進(jìn)行編碼
data = urllib.urlencode(data)
#拼接地址跟數(shù)據(jù)
requst = url + '?' + data
#打開請求,獲取對象
requstreponse = urllib2.urlopen(requst)
#讀取服務(wù)器返回的數(shù)據(jù)
reponsestr = requstreponse.read()
#打印數(shù)據(jù)
reponsestr = reponsestr.decode('utf-8')
print reponsestr
提問者:Slowman
2017-11-30 15:07
總結(jié)
以上是生活随笔為你收集整理的python get请求 url传参_用Python-get方法向页面发起请求,参数传不进去是怎么回事...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python注释可以辅助程序调试吗_Py
- 下一篇: websocket python爬虫_p