Python accesses webservice via Suds
This article describes how to access the WebService interface through the SUDS library
Python accesses WebService Suds installation WebService access test via Suds
Suds Installation
Suds: is a lightweight soap client, Suds-jurko is a branch version of Suds.
Install command: Pip install Suds
Install SUDS on my Mac did not succeed, so I chose to install Suds-jurko
mbookpro:~ mervin$ pip3.6 Install Suds-jurko collecting Suds-jurko downloading suds-jurko-0.6.tar.bz2
(143kB)
100% |████████████████████████████████| 153kB 5.0kb/s
Installing collected Packages:suds-jurko
Running setup.py Install for Suds-jurko ... done
successfully Installed suds-jurko-0.6
WebService Access Test
I have chosen a public network of webservice:
QQ Online Status Test
There's only one way to do this webservice –qqcheckonline (xs:string Qqcode)
Here is a WebService test tool Storm
Link: https://pan.baidu.com/s/1jJmchk6 Password: dk64
Suds Call:
#!/library/frameworks/python.framework/versions/3.6/bin/python3
#-*-coding:utf-8-*-
# Author By:mervin Yan
# WebSite : Http://blog.csdn.net/zhumingyan from
suds.client import client
#要访问的Webservice地址
url = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl"
#创建Webservice Client Object
Client = Client (URL)
#print (client) can print out all methods of the client object
#print (client)
# Client.service.qqCheckOnline method
result = Client.service.qqCheckOnline ("229151840")
print ("QQ online results are:" + Result
The results of the operation are:
QQ Online Results: Y
[finished in 2.1s]