Zimbra communication handler.
Bases: object
Zimbra communication handler.
Sends requests to the zimbra SOAP server and returns the responses in a dictionary.
Convenience method to quickly generate a token
Parameters: |
|
---|---|
Returns: | The request |
Send the request.
Parameters: |
|
---|---|
Raises : | pythonzimbra.exceptions.communication.SoapFailure or urllib2.HTTPError |
Timeout of the request
URL to the zimbra soap interface
Request handling and generation.
Bases: object
Zimbra SOAP request generation and handling.
Add a request.
This adds a request to the body or to the batchrequest-node if batch requesting is enabled. Has to update the self.batch_request_id after adding a batch request!
Implementing classes should call this first for checks.
Parameters: |
|
---|---|
Returns: | The current request id (if batch processing) or None |
Return type: | int or None |
Are we doing batch requests?
If so, keep the current request id
Enables batch request gathering.
Do this first and then consecutively call “add_request” to add more requests.
Parameters: | onerror – “continue” (default) if one request fails (and response with soap Faults for the request) or “stop” processing. |
---|
The specific request will set its request type (json, xml) here
Convenience function to inject the auth token into the header.
Parameters: | token – Auth token |
---|
Set header context parameters. Refer to the top of <Zimbra Server-Root>/docs/soap.txt about specifics.
The <format>-Parameter cannot be changed, because it is set by the implementing class.
Should be called by implementing method to check for valid context params.
Parameters: | params – A Dict containing context parameters. |
---|
Valid parameter name for Soap context
Zimbra request handling (JSON)
Request handling and generation (XML version).
Zimbra response access.
Bases: object
Unified access to Zimbra responses.
Returns an informative dictionary about a batch response.
Returns a dictionary containing the following information:
{
"hasFault": <bool wether the batch has at least one SoapFault
"idToName": {
<A dictionary mapping a response id to the corresponding
response name or Fault>
}
"nameToId": {
<A dictionary mapping response names (or Fault) to the
corresponding response id(s)
}
}
If the method is called with no batch response existing, returns None
Returns: | Informative dictionary |
---|---|
Return type: | dict or None |
Return the body of the response.
Returns: | The response body in the documented dictionary format |
---|---|
Return type: | dict |
Returns the fault error code of this response (overridden)
For batch responses, we return a dict of fault codes. The key is the request_id.
Returns: | Fault code string |
---|
Returns the fault error message of this response (overridden)
For batch responses, we return a dict of fault messages. The key is the request_id.
Returns: | Fault code error message |
---|
Return the header of the response.
Returns: | The response header in the documented dictionary format |
---|---|
Return type: | dict |
Returns the response with the given request_id.
Returns the specific response. If “request_id” isn’t provided or 0, the first (or only one in a non-batch) response is returned.
Returns whether we have a BatchResponse.
Returns: | Whether we have a BatchResponse |
---|---|
Return type: | bool |
Checks, wether this response has at least one fault response ( supports both batch and single responses)
The actual response will set its response type (xml, json) here
JSON-Response format
XML-Response format.