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.