python的webservice请求
1.pip install client 2.pip install suds-jurko
#coding=utf-8
from suds.client import Client
import time
url='http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl'
client = Client(url)
def get_methods_name():
method_list=[]
for i in client.wsdl.services[0].ports[0].methods:
method_list.append(i)
return method_list
for i in get_methods_name():
print(i)
time.sleep(5)
func=getattr(client.service,i)
print(func('221.112.223.1'))
# print(client.service.getCountryCityByIp(theIpAddress='221.112.223.1')) -------------------------------------------------------------------------------------------------------------
#coding=utf-8
from suds.client import Client
class Webservice_Test:
def __init__(self,url):
self.client=Client(url)
def get_methods_name(self):
method_list = []
for i in self.client.wsdl.services[0].ports[0].methods:
method_list.append(i)
return method_list
#获取方法的参数
def get_method_parm(self,method_name):
method=self.client.wsdl.services[0].ports[0].methods[method_name]
input_parames=method.binding.input
params=input_parames.param_defs(method)[0]
return params[1].name,params[1].type[0]
def run_main(self):
for method in self.get_methods_name():
func=getattr(self.client.service,method)
print(func('221.112.223.1'))
if __name__ == '__main__':
url = 'http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl'
web=Webservice_Test(url)
# name=web.get_methods_name()[0]
# print(web.get_method_parm(name))
print(web.run_main())
python的webservice请求的更多相关文章
- python通过http请求发送soap报文进行webservice接口调用
最近学习Python调用webservice 接口,开始的时候主要采用suds 的方式生产client调用,后来发现公司的短信接口采用的是soap报文来调用的,然后开始了谷歌,最后采用httplib ...
- python通过webservice连接cmdbuild
cmdbuild的部署可以查看文章:http://20988902.blog.51cto.com/805922/1541289 部署成功后,访问http://192.168.1.1:8080/cmdb ...
- 用Python写WebService接口并且调用
一.用ladon框架封装Python为Webservice接口 另用soaplib实现请看: http://www.jianshu.com/p/ad3c27d2a946 功能实现的同时,希望将接 ...
- 用ladon框架封装Python为Webservice接口以及调用接口的方法
一.用ladon框架封装Python为Webservice接口 功能实现的同时,希望将接口开放给别人,而封装python接口的一个再简单不过的框架Ladon,而且提供不同的协议,包括SOAP和Json ...
- 关于python测试webservice接口的视频分享
现在大公司非常流行用python做产品的测试框架,还有对于一些快速原型产品的开发也好,很好地支持OO编程,代码易读.Python的更新挺快的,尤其是第三方库. 对于测试人员,代码基础薄弱,用pytho ...
- Python调用Webservice、访问网页
昨天在调试Webservice的时候,由于不想写测试程序,就想用Python访问Webservice,结果还是相当的麻烦.远没有VSIDE用的方便 不得不说VS还是很强大的,人性化做的很好,不需要你看 ...
- python 开发webService
最近在学习用python 开发webservice,费了半天时间把环境搭好,记录下具体过程,以备后用. 首先系统上要有python.其次要用python进行webservice开发,还需要一些库: 1 ...
- Python中http请求方法库汇总
最近在使用python做接口测试,发现python中http请求方法有许多种,今天抽点时间把相关内容整理,分享给大家,具体内容如下所示: 一.python自带库----urllib2 python自带 ...
- python模拟Get请求保存网易歌曲的url
python模拟Get请求保存网易歌曲的url 作者:vpoet mail:vpoet_sir@163.com 日期:大约在夏季 #coding:utf-8 import requests impor ...
随机推荐
- 图像处理之基础---图像缩放中的双线性插值c实现
在进入频域变换之前, 我们还是轻松一下,再搞点平面上的变化来看看.这把选了一个双线性插值(Bilinear interpolation)来实现是源于看到了csdn上别人的问题, 权且实现一个函数,方便 ...
- [RK3288][Android6.0] 音频调试方法小结【转】
本文转载自:http://blog.csdn.net/kris_fei/article/details/70053135 Platform: ROCKCHIPOS: Android 6.0Kernel ...
- 分享一个全开源的ASP.NET快速开发平台,能快速开发OA CRM ERP 等系统
bingo炸了 2017/3/30 16:28:14 阅读(870) 评论(0) 公司业务量比较大,接了很多项目,为了缩短开发周期老板让我牵头搭建了一个快速开发平台. 我们主要的业务是做OA.CRM. ...
- CentOS下VI命令整理
Vi共分三种模式,分别是“一般模式”.“编辑模式”与“命令行命令模式”. l 一般模式:vi处理文件时,一进入该文件就是一般模式.在这个模式中,可以使用“上下左右”键来移动光标,可以使 ...
- go语言---map
go语言---map https://blog.csdn.net/cyk2396/article/details/78890185 一.map的用法: type PersonDB struct { I ...
- 杂项-Java:FreeMarker
ylbtech-杂项-Java:FreeMarker 1.返回顶部 1. FreeMarker是一款模板引擎: 即一种基于模板和要改变的数据, 并用来生成输出文本(HTML网页.电子邮件.配置文件.源 ...
- STM32:片上Flash 操作
之前IAP时候记录过一些,今天对特定地方写又加深了印象,写与擦除都需要先unclock //读取指定地址的半字(16位数据) //faddr:读地址(此地址必须为2的倍数!!) //返回值:对应数据. ...
- 22.Extjs Panel中显示多行工具栏(tbar)
转自:http://blog.sina.com.cn/s/blog_454fbf740100t0xj.html 在应用程序的制作中,我们经常性的会用到工具栏,在Extjs中Panel中提供了tbar和 ...
- 移动端html touch事件
诸如智能手机和平板电脑一类的移动设备通常会有一(capacitive touch-sensitivescreen),以捕捉用户的手指所做的交互.随着移动网络的发展,其能够支持越来越复杂的应用,web开 ...
- Java中的APT的工作过程
Java中的APT的工作过程 APT即Annotatino Processing Tool, 他的作用是处理代码中的注解, 用来生成代码, 换句话说, 这是用代码生成代码的工具, 减少boilerpl ...