from pysimplesoap.client import SoapClient
client = SoapClient(wsdl="https://platform.mediamind.com/Eyeblaster.MediaMind.API/V2/AuthenticationService.svc?wsdl")
auth_token = client.ClientLogin(username = 'user', password = 'pass',
applicationKey = 'test')
#I got authenticated here
token= auth_token['ClientLoginResult']
campaign_client = SoapClient(wsdl="https://platform.mediamind.com/Eyeblaster.MediaMind.API/V2/CampaignService.svc?wsdl"
,trace = False)
我想在下面调用获取联系人定义的简单方法
Show
Parameters
Name Type Description
ContactID Int32 The contact ID. Mandatory field.
UserSecurityToken String Contains a string that uniquely identifies the current Sizmek Trafficking API session. You may retrieve the token after logging into the AuthenticationService
_
Show
Response
Name Type Description
Contact ContactInfo Returns the contact information used by ContactInfo
我相信我无法在这里正确传递参数。这就是形成错误请求的原因
test = {'UserSecurityToken' :token,'ContactID' : 1 }
data = campaign_client.GetContact(test )
在 WSDL 客户端中,我可以看到下面的代码来获取带参数的方法。
def __getattr__(self, attr):
"""Return a pseudo-method that can be called"""
if not self.services: # not using WSDL?
return lambda self=self, *args, **kwargs: self.call(attr, *args, **kwargs)
else: # using WSDL:
return lambda *args, **kwargs: self.wsdl_call(attr, *args, **kwargs)