The elementsoap.HTTPClient Module

This module implements a simple XML-over-HTTP transport layer.

Module Contents

HTTPClient(url) (class) [#]

HTTP client class.

url
Target URL.

For more information about this class, see The HTTPClient Class.

HTTPError (class) [#]

HTTP exception.

For more information about this class, see The HTTPError Class.

The HTTPClient Class

HTTPClient(url) (class) [#]

HTTP client class.

url
Target URL.

do_request(body, path=None, method="POST", content_type="text/xml", extra_headers=None, parser=None) ⇒ ElementTree [#]

Issues an HTTP request.

body
Request body (a string or an ElementTree object).
path=
Optional path. If omitted, the path is derived from the host URL.
method=
Optional HTTP method. The default is POST.
content_type=
Optional Content-Type setting. The default is text/xml.
extra_headers=
List of additional HTTP header fields. The list should contain (field, value)-tuples.
parser=
Optional parser function. If omitted, the standard ElementTree parse function is used.
Returns:
An ElementTree instance containing the HTTP response.
Raises HTTPError:
If the server returned an HTTP error code. The error code and other details can be obtained from the exception object.

The HTTPError Class

HTTPError (class) [#]

HTTP exception. This exception contains the error code, the error message, an HTTP header dictionary, and a file handle, in that order. The file handle can be used to read the error response.