使用suds创建soap请求

时间:2015-11-06 11:50:21

标签: python python-2.7 soap suds

我在python中需要一些suds请求的帮助。

生成的XML请求如下所示

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
    <m:ExternalApiHeader xmlns:m="http://www.GlobalBettingExchange.com/ExternalAPI/" version="" languageCode="" username="" password="" applicationIdentifier=""/>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
    <m:GetEventSubTreeWithSelections xmlns:m="http://www.GlobalBettingExchange.com/ExternalAPI/">
        <m:getEventSubTreeWithSelectionsRequest WantPlayMarkets="true">
            <m:EventClassifierIds>2147483647</m:EventClassifierIds>
        </m:getEventSubTreeWithSelectionsRequest>
    </m:GetEventSubTreeWithSelections>
</SOAP-ENV:Body>

我已经创建了python脚本,我唯一无法弄清楚如何传递值EventClassifierIds,这是2147483647

import suds
url = 'http://api.betdaq.com/v2.0/API.wsdl'
client = suds.client.Client(url)

#prepare headers
token=client.factory.create('ExternalApiHeader')
token._version='2'
token._languageCode='en'
token._username=''
token._password=''
client.set_options(soapheaders=token)

#reguest
result = client.service.GetEventSubTreeWithSelections('false')
print result

0 个答案:

没有答案