Last active
August 29, 2015 14:19
-
-
Save sandromello/7277e7e12efec8c582b0 to your computer and use it in GitHub Desktop.
Get User Zimbra Token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
soapEnvelope = """<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header>\ | |
<context xmlns="urn:zimbra"><nosession/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAccount">\ | |
<account by="name">%s</account><password>%s</password></AuthRequest></soap:Body>\ | |
</soap:Envelope>""" % ('usuario@dominio', 'senha') | |
headers = { | |
'Content-Type' : 'text/soap+xml' | |
} | |
zimbraUrl = 'https://host_ssl/service/soap' | |
req = requests.post(url=zimbraUrl, headers=headers, data=soapEnvelope) | |
print req.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment