当前位置: 移动技术网 > IT编程>脚本编程>Python > 第七篇:suds.TypeNotFound: Type not found: '(string, http://schemas.xmlsoap.org/soap/encoding/, )'

第七篇:suds.TypeNotFound: Type not found: '(string, http://schemas.xmlsoap.org/soap/encoding/, )'

2019年01月25日  | 移动技术网IT编程  | 我要评论

乌龟为什么能活那么久,谁有哪个网站你懂的,大连金州华臣影城

想要用python的suds模块调用webservice地址做自动测试,但是找了很多方法都失败了,最终找到另外一个模块可以作为客户端访问服务器地址。

1.针对非安全的http

from zeep import client
url = "http://***?wsdl"
from zeep import client
client = client(url)
result = client.service.getcircuit('11111') # getcircuit 为服务端提供的接口服务,可以调用,括号中传相应的参数
print(result)

打印结果:

{
'_value_1': '{"errormsg":"没有找到路由信息!"}',
'id': none,
'href': none,
'_attr_1': {
}
}

2.针对安全的https

from requests import session
from zeep import client
from zeep.transports import transport
url = "https://***?wsdl"
session = session()    # 这里是因为url是https,不然不需要transport
session.verify = false
transport = transport(session=session)
client = client(url)
result = client.service.getcircuit('11111') # getcircuit 为服务端提供的接口服务,可以调用,括号中传相应的参数
print(result)

 关于zeep可参考:https://python-zeep.readthedocs.io/en/master/

本文参考:https://blog.csdn.net/ohmyberry/article/details/80430944?utm_source=blogxgwz4

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网