Python3 through Suds access WebService

Source: Internet
Author: User
Tags soap client
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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.