mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.89k stars 586 forks source link

How to set timestamp and digest #27

Closed ovnicraft closed 8 years ago

ovnicraft commented 8 years ago

I want to test this lib as alternative from suds. I have an specific issue, i need to set wsdl wsse request my specific timestamp and digest (this comes from auth wsdl).

this code from suds for reference: https://gist.github.com/ovnicraft/69dccd4aaf8de09dac91071a3305a28d#file-gistfile1-txt

line 7 and 11 as you see i set nonec and timestamp. I read the code from wsse but not found the way.

any hint around ?

mvantellingen commented 8 years ago

Should be possible using the following:

from zeep import Client
from zeep.wsse.username import UsernameToken

client = Client(
    wsdl, wsse=UsernameToken(CEDULA, response.Digest, use_digest=True))

See https://github.com/mvantellingen/python-zeep/blob/master/src/zeep/wsse/username.py#L84. Or do you need to supply custom values to the none/created/exired headers?

ovnicraft commented 8 years ago

I check your code, and yes i need to pass custom values for date, nonce, digest.

mvantellingen commented 8 years ago

Just update the UsernameToken class to accept nonce, created, and password_digest kwargs

Let me know if any more problems arise :)

ovnicraft commented 8 years ago

@mvantellingen great i will check it