python get请求 url传参_用Python-get方法向页面发起请求,参数传不进去是怎么回事...
生活随笔
收集整理的這篇文章主要介紹了
python get请求 url传参_用Python-get方法向页面发起请求,参数传不进去是怎么回事...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
源自:4-1 接口測試工具-python-get接口實戰
用Python-get方法向頁面發起請求,參數傳不進去是怎么回事
#-*-coding:utf-8-*-
import urllib
import urllib2
url = 'http://cms.partner.wht.cn/login/login.do'
#定義數據
data = {}
data['adminName'] = 'admin'
data['adminPassword'] = '96e79218965eb72c92a549dd5a330112'
#對請求數據進行編碼
data = urllib.urlencode(data)
#拼接地址跟數據
requst = url + '?' + data
#打開請求,獲取對象
requstreponse = urllib2.urlopen(requst)
#讀取服務器返回的數據
reponsestr = requstreponse.read()
#打印數據
reponsestr = reponsestr.decode('utf-8')
print reponsestr
提問者:Slowman
2017-11-30 15:07
總結
以上是生活随笔為你收集整理的python get请求 url传参_用Python-get方法向页面发起请求,参数传不进去是怎么回事...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python注释可以辅助程序调试吗_Py
- 下一篇: vb6实现union数据结构_数据结构与