views:

394

answers:

1

I'm trying to use the Zimbra SOAP API from Python to programmatically modify & cleanup my contacts but I'm having trouble getting started.

What I have so far is:

from SOAPpy import SOAPProxy
url = 'https://zimbra/service/soap'
auth = {"account": "xxxxx", "password": "xxxxx"}

zimbra = SOAPProxy(url, 'urn:zimbra')
zimbraAuth = SOAPProxy(url, "urn:zimbraAccount")
zimbraMail = SOAPProxy(url, "urn:zimbraMail")

response = zimbraAuth.AuthRequest(**auth)
authToken = response.authToken 

I've logged in successfully, but can't pass this authToken in further requests.

My understanding is that any zimbraMail requests need to have a header in the urn:zimbra namespace with the authToken set there, but being new to SOAP I have no idea how to do so.

I'm not married to using SOAPpy so any example code for another library would be well appreciated.

A: 

Hi MikeyB. Did you have any success with SUDS? I'm also quite new to SOAP and I couldn't figure out how to rewrite your SOAPPy example in SUDS. For example, how to pass the urn?

francesco
Heh... not yet. I got busy with something else before I could actually dive into it. (BTW, your answer should be a comment)
MikeyB
ok, I'll keep trying and share my findings here if I have any success. You're right about the comment, sorry about that.
francesco