python编写webservice接口
1.pip install suds-jurko
2.pip install client
#coding=utf-8
from suds.client import Client
class WebserviceTest:
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_parame(self,method_name):
method = self.client.wsdl.services[0].ports[0].methods[method_name]
input_parames = method.binding.input
parames = input_parames.param_defs(method)[0]
return parames[1].name,parames[1].type[0]
def run_main(self):
for method in self.get_methods_name():
func = getattr(self.client.service,method)
print func('122.122.122.2')
if __name__ == '__main__':
url = 'http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl'
web = WebserviceTest(url)
name = web.get_methods_name()[0]
print web.run_main()
python编写webservice接口的更多相关文章
- 关于python测试webservice接口的视频分享
现在大公司非常流行用python做产品的测试框架,还有对于一些快速原型产品的开发也好,很好地支持OO编程,代码易读.Python的更新挺快的,尤其是第三方库. 对于测试人员,代码基础薄弱,用pytho ...
- 用Python写WebService接口并且调用
一.用ladon框架封装Python为Webservice接口 另用soaplib实现请看: http://www.jianshu.com/p/ad3c27d2a946 功能实现的同时,希望将接 ...
- 用ladon框架封装Python为Webservice接口以及调用接口的方法
一.用ladon框架封装Python为Webservice接口 功能实现的同时,希望将接口开放给别人,而封装python接口的一个再简单不过的框架Ladon,而且提供不同的协议,包括SOAP和Json ...
- (转)python编写登录接口
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://506554897.blog.51cto.com/2823970/1907262 ...
- 使用 Python 编写登陆接口
# 使用 Python 编写登陆接口# Create Date: 2017.10.31 Tuesday# Author: Eric Zhao# -*- coding:utf-8 -*-'''编写登陆接 ...
- python通过webservice接口实现配置下发
项目上要开发一个小工具,通过webservice接口实现配置下发,考虑到python的第三方库对soap的良好支持,果断决定用python来完成这一使命. Python的支持webservice的第三 ...
- 使用loadrunner编写webservice接口请求
1.使用工具: loadrunner12,本实例截图中都是loadrunner12工具 2.操作步骤: 1).新建脚本,选择Web Services协议: 2).选择工具栏: 3).点击Import, ...
- python调用webservice接口
使用suds这个第三方模块 from suds.client import Clienturl = 'http://ip:port/?wsdl'cilent=Client(url)print cile ...
- python开发笔记-python调用webservice接口
环境描述: 操作系统版本: root@9deba54adab7:/# uname -a Linux 9deba54adab7 --generic #-Ubuntu SMP Thu Dec :: UTC ...
随机推荐
- Python科学计算的瑞士军刀——Anaconda 安装与配置
Introduce Python是一种强大的编程语言.其提供了非常多用于科学计算的模块,常见的包含numpy.scipy和matplotlib.要利用Python进行科学计算.就须要一一安装所需的模块 ...
- LeetCode 451. Sort Characters By Frequency (根据字符出现频率排序)
Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: ...
- 深入struts2(二) ---stuts2长处和主要包、类功能
1.1 Struts2 上节已讲.struts2在webwork基础发展起来的mvc框架.MVC框架相信一般码农都比較了解,这里不再重说. 在这里只对于一下struts1,struts2做了哪 ...
- CoffeeScript的缩进
CoffeeScript用缩进代替了花括符"{}",作用范围的划分只靠缩进.这带来代码精简.简洁的同时,有时候也让人困惑. 比如说: if 3 > 1 alert(" ...
- UVA1601 The Morning afther Halloween
题目大意 w h (w, h <= 16)的网格有 n ( n <= 3) 个小写字母(代表鬼)其余的是‘#’(代表障碍格) 或 ‘ ’(代表空格. 要求把他们移动到对应的大写字母里.每步 ...
- 并发与并行(concurrency vs parallesim)
最近对计算机中并发(concurrency)和并行(parallesim)这两个词的区别很迷惑,将搜索到的相关内容整理如下. http://www.vaikan.com/docs/Concurrenc ...
- JavaScript Patterns 1 Introduction
1.1 Pattern "theme of recurring events or objects… it can be a template or model which can be u ...
- B1877 [SDOI2009]晨跑 费用流
其实之前写过一个板子,但是一点印象都没有,所以今天重写了一下,顺便把这个题当成板子就行了. 其实费用流就是把bfs换成spfa,但是中间有一个原则,就是费用优先,在费用(就是c)上跑spfa,顺便求出 ...
- java异步编程
异步编程提供了一个非阻塞事件驱动的模型.通过异步消除阻塞,可以让web服务响应更多请求.可以让系统更高效的执行.比如log框架,记录日志或异常时异步执行可避免影响正常业务流程的执行. 异步变成如何把线 ...
- ref 和out的区别
在C#语言中,参数的传递有两种,一种是值传递,一种是引用传递.ref与out这两种方式都属于引用传递,只是他们的用法稍有不同.下面看几个例子 使用ref的例子 class test { static ...