cpython: fb5bd513751f (original) (raw)

--- a/Doc/library/xmlrpclib.rst +++ b/Doc/library/xmlrpclib.rst @@ -21,7 +21,7 @@ -------------- -XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a +XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP(S) as a transport. With it, a client can call methods with parameters on a remote server (the server is named by a URI) and get back structured data. This module supports writing XML-RPC client code; it handles all the details of translating @@ -37,7 +37,7 @@ between conformable Python objects and X .. versionchanged:: 2.7.9 For https URIs, :mod:xmlrpclib now performs all the necessary certificate

.. class:: ServerProxy(uri[, transport[, encoding[, verbose[, allow_none[, use_datetime[, context]]]]]]) @@ -48,11 +48,15 @@ between conformable Python objects and X :class:SafeTransport instance for https: URLs and an internal HTTP :class:Transport instance otherwise. The optional third argument is an encoding, by default UTF-8. The optional fourth argument is a debugging flag. +

@@ -71,40 +75,42 @@ between conformable Python objects and X methods it supports (service discovery) and fetch other server-associated metadata.

Servers that support the XML introspection API support some common methods -grouped under the reserved :attr:system attribute: +grouped under the reserved :attr:~ServerProxy.system attribute: .. method:: ServerProxy.system.listMethods() @@ -249,24 +255,26 @@ The client code for the preceding server DateTime Objects ---------------- -This class may be initialized with seconds since the epoch, a time -tuple, an ISO 8601 time/date string, or a :class:datetime.datetime -instance. It has the following methods, supported mainly for internal -use by the marshalling/unmarshalling code: +.. class:: DateTime +

-.. method:: DateTime.decode(string)

-.. method:: DateTime.encode(out)

-It also supports certain of Python's built-in operators through :meth:__cmp__ -and :meth:__repr__ methods.

A working example follows. The server code:: @@ -300,36 +308,38 @@ The client code for the preceding server Binary Objects -------------- -This class may be initialized from string data (which may include NULs). The -primary access to the content of a :class:Binary object is provided by an -attribute: +.. class:: Binary +

-.. attribute:: Binary.data

-:class:Binary objects have the following methods, supported mainly for -internal use by the marshalling/unmarshalling code:

-.. method:: Binary.decode(string)

-.. method:: Binary.encode(out)

-It also supports certain of Python's built-in operators through a -:meth:__cmp__ method.

Example usage of the binary objects. We're going to transfer an image over XMLRPC:: @@ -360,18 +370,20 @@ The client gets the image and saves it t Fault Objects ------------- -A :class:Fault object encapsulates the content of an XML-RPC fault tag. Fault -objects have the following attributes: +.. class:: Fault +

-.. attribute:: Fault.faultCode

-.. attribute:: Fault.faultString

In the following example we're going to intentionally cause a :exc:Fault by returning a complex type object. The server code:: @@ -408,30 +420,32 @@ The client code for the preceding server ProtocolError Objects --------------------- -A :class:ProtocolError object describes a protocol error in the underlying -transport layer (such as a 404 'not found' error if the server named by the URI -does not exist). It has the following attributes: +.. class:: ProtocolError +

-.. attribute:: ProtocolError.url

-.. attribute:: ProtocolError.errcode

-.. attribute:: ProtocolError.errmsg

-.. attribute:: ProtocolError.headers

In the following example we're going to intentionally cause a :exc:ProtocolError by providing a URI that doesn't point to an XMLRPC server::