Slowman
2017-11-30 15:07
#-*-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
#-*-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
接口测试基础之入门篇
74680 学习 · 176 问题
相似问题