开发者

Custom authentication in suds library (Python)

I need to access a SOAP server with WSDL where the authentication is done by sending two parameters, UserId and AccessToken. I tried this way: token = UsernameToken( UserId, AccessToken ) token.setnonce() token.setcreated()

security = Security()
security.tokens.append(token)


client = 开发者_如何学运维Client(URL)
client.set_options(wsse=security)

and suds throwed this error

URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>

How do I add this parameters to my request? Or am I doing something else wrong?


If the parameters are supposed to part of a header, you can do it that way:

header = client.factory.create('HeaderNameInWSDL')
header.UserId = 'foo'
header.AccessToken = 'bar%n3'
client.set_options(soapheaders=header)

Then do you stuff.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜