"""https://blog.csdn.net/weixin_43790276/article/details/89853310"""
#python2 中需要安装 suds, 而且先需要安装client,不然会报错
#python3 中需要安装 suds-py3, "pip install suds-py3"
#导入Client
from suds.client import Client
# url需要以“?WSDL(不区分大小写)”,前面是具体的接口地址
# WSDL 是网络服务描述语言(Web Services Description Language),
# 是使用XML写的用于描述Web Services,以及如何访问 Web Services的文档
ws_api_url = "http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?WSDL"
#创建Client对象来连接 webservice 的url,
client = Client(ws_api_url)
print(client)
# 调用webservice中的接口,返回数据
# "getMobileCodeInfo"接口名称,()中是的是接口参数
resp = client.service.getMobileCodeInfo(mobileCode="13122907522")
print(resp)