Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / module-xmlrpclib.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-SimpleXMLRPCServer.html" />
<link rel="prev" href="module-Cookie.html" />
<link rel="parent" href="internet.html" />
<link rel="next" href="serverproxy-objects.html" />
<meta name='aesop' content='information' />
<title>11.22 xmlrpclib -- XML-RPC client access</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="11.21.3 Example"
href="cookie-example.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="11. Internet Protocols and"
href="internet.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="11.22.1 ServerProxy Objects"
href="serverproxy-objects.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="cookie-example.html">11.21.3 Example</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="serverproxy-objects.html">11.22.1 ServerProxy Objects</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00132200000000000000000">
11.22 <tt class="module">xmlrpclib</tt> -- XML-RPC client access</A>
</H1>
<P>
<A NAME="module-xmlrpclib"></A>
<P>
<span class="versionnote">New in version 2.2.</span>
<P>
XML-RPC is a Remote Procedure Call method that uses XML passed via
HTTP 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 between conformable Python
objects and XML on the wire.
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-3698' xml:id='l2h-3698' class="class">ServerProxy</tt></b>(</nobr></td>
<td><var>uri</var><big>[</big><var>, transport</var><big>[</big><var>,
encoding</var><big>[</big><var>, verbose</var><big>[</big><var>,
allow_none</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
A <tt class="class">ServerProxy</tt> instance is an object that manages communication
with a remote XML-RPC server. The required first argument is a URI
(Uniform Resource Indicator), and will normally be the URL of the
server. The optional second argument is a transport factory instance;
by default it is an internal <tt class="class">SafeTransport</tt> instance for https:
URLs and an internal HTTP <tt class="class">Transport</tt> instance otherwise. The
optional third argument is an encoding, by default UTF-8. The optional
fourth argument is a debugging flag. If <var>allow_none</var> is true,
the Python constant <code>None</code> will be translated into XML; the
default behaviour is for <code>None</code> to raise a <tt class="exception">TypeError</tt>.
This is a commonly-used extension to the XML-RPC specification, but isn't
supported by all clients and servers; see
<a class="url" href="http://ontosys.com/xml-rpc/extensions.php">http://ontosys.com/xml-rpc/extensions.php</a> for a description.
<P>
Both the HTTP and HTTPS transports support the URL syntax extension for
HTTP Basic Authentication: <code>http://user:pass@host:port/path</code>. The
<code>user:pass</code> portion will be base64-encoded as an HTTP `Authorization'
header, and sent to the remote server as part of the connection process
when invoking an XML-RPC method. You only need to use this if the
remote server requires a Basic Authentication user and password.
<P>
The returned instance is a proxy object with methods that can be used
to invoke corresponding RPC calls on the remote server. If the remote
server supports the introspection API, the proxy can also be used to query
the remote server for the methods it supports (service discovery) and
fetch other server-associated metadata.
<P>
<tt class="class">ServerProxy</tt> instance methods take Python basic types and objects as
arguments and return Python basic types and classes. Types that are
conformable (e.g. that can be marshalled through XML), include the
following (and except where noted, they are unmarshalled as the same
Python type):
<P>
<div class="center"><table class="realtable">
<thead>
<tr>
<th class="left" >Name</th>
<th class="left" >Meaning</th>
</tr>
</thead>
<tbody>
<tr><td class="left" valign="baseline"><tt class="constant">boolean</tt></td>
<td class="left" >The <tt class="constant">True</tt> and <tt class="constant">False</tt> constants</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">integers</tt></td>
<td class="left" >Pass in directly</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">floating-point numbers</tt></td>
<td class="left" >Pass in directly</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">strings</tt></td>
<td class="left" >Pass in directly</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">arrays</tt></td>
<td class="left" >Any Python sequence type containing conformable
elements. Arrays are returned as lists</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">structures</tt></td>
<td class="left" >A Python dictionary. Keys must be strings,
values may be any conformable type.</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">dates</tt></td>
<td class="left" >in seconds since the epoch; pass in an instance of the
<tt class="class">DateTime</tt> wrapper class</td></tr>
<tr><td class="left" valign="baseline"><tt class="constant">binary data</tt></td>
<td class="left" >pass in an instance of the <tt class="class">Binary</tt>
wrapper class</td></tr></tbody>
</table></div>
<P>
This is the full set of data types supported by XML-RPC. Method calls
may also raise a special <tt class="exception">Fault</tt> instance, used to signal
XML-RPC server errors, or <tt class="exception">ProtocolError</tt> used to signal an
error in the HTTP/HTTPS transport layer. Note that even though starting
with Python 2.2 you can subclass builtin types, the xmlrpclib module
currently does not marshal instances of such subclasses.
<P>
When passing strings, characters special to XML such as "<tt class="samp">&lt;</tt>",
"<tt class="samp">&gt;</tt>", and "<tt class="samp">&amp;</tt>" will be automatically escaped. However, it's
the caller's responsibility to ensure that the string is free of
characters that aren't allowed in XML, such as the control characters
with ASCII values between 0 and 31; failing to do this will result in
an XML-RPC request that isn't well-formed XML. If you have to pass
arbitrary strings via XML-RPC, use the <tt class="class">Binary</tt> wrapper class
described below.
<P>
<tt class="class">Server</tt> is retained as an alias for <tt class="class">ServerProxy</tt> for backwards
compatibility. New code should use <tt class="class">ServerProxy</tt>.
<P>
</dl>
<P>
<div class="seealso">
<p class="heading">See Also:</p>
<dl compact="compact" class="seetitle">
<dt><em class="citetitle"><a href="http://xmlrpc-c.sourceforge.net/xmlrpc-howto/xmlrpc-howto.html"
>XML-RPC HOWTO</a></em></dt>
<dd>A good description of XML operation and
client software in several languages. Contains pretty much
everything an XML-RPC client developer needs to know.</dd>
</dl>
<dl compact="compact" class="seetitle">
<dt><em class="citetitle"><a href="http://xmlrpc-c.sourceforge.net/hacks.php"
>XML-RPC-Hacks page</a></em></dt>
<dd>Extensions for various open-source
libraries to support introspection and multicall.</dd>
</dl>
</div>
<P>
<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
<UL CLASS="ChildLinks">
<LI><A href="serverproxy-objects.html">11.22.1 ServerProxy Objects</a>
<LI><A href="boolean-objects.html">11.22.2 Boolean Objects</a>
<LI><A href="datetime-objects.html">11.22.3 DateTime Objects</a>
<LI><A href="binary-objects.html">11.22.4 Binary Objects</a>
<LI><A href="fault-objects.html">11.22.5 Fault Objects</a>
<LI><A href="protocol-error-objects.html">11.22.6 ProtocolError Objects</a>
<LI><A href="node559.html">11.22.7 MultiCall Objects</a>
<LI><A href="node560.html">11.22.8 Convenience Functions</a>
<LI><A href="xmlrpc-client-example.html">11.22.9 Example of Client Usage</a>
</ul>
<!--End of Table of Child-Links-->
</div>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="11.21.3 Example"
href="cookie-example.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="11. Internet Protocols and"
href="internet.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="11.22.1 ServerProxy Objects"
href="serverproxy-objects.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="cookie-example.html">11.21.3 Example</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="serverproxy-objects.html">11.22.1 ServerProxy Objects</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>