e88cd377 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JSON-RPC Proxy — JSONRPC v1.0 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="JSONRPC v1.0 documentation" href="index.html" />
<link rel="next" title="jsonrpc.jsonutil" href="jsonutil.html" />
<link rel="prev" title="JSON-RPC Server" href="server.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="jsonutil.html" title="jsonrpc.jsonutil"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="server.html" title="JSON-RPC Server"
accesskey="P">previous</a> |</li>
<li><a href="index.html">JSONRPC v1.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-jsonrpc.proxy">
<span id="json-rpc-proxy"></span><h1>JSON-RPC Proxy<a class="headerlink" href="#module-jsonrpc.proxy" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="jsonrpc.proxy.JSONRPCProxy">
<em class="property">class </em><tt class="descclassname">jsonrpc.proxy.</tt><tt class="descname">JSONRPCProxy</tt><big>(</big><em>host</em>, <em>path='/jsonrpc'</em>, <em>serviceName=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy" title="Permalink to this definition">¶</a></dt>
<dd><p>A class implementing a JSON-RPC Proxy.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>host</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The HTTP server hosting the JSON-RPC server</li>
<li><strong>path</strong> (<a class="reference external" href="http://docs.python.org/2.7/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The path where the JSON-RPC server can be found</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>There are two ways of instantiating this class:
- JSONRPCProxy.from_url(url) – give the absolute url to the JSON-RPC server
- JSONRPC(host, path) – break up the url into smaller parts</p>
<dl class="method">
<dt id="jsonrpc.proxy.JSONRPCProxy.batch_call">
<tt class="descname">batch_call</tt><big>(</big><em>names</em>, <em>*params</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy.batch_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy.batch_call" title="Permalink to this definition">¶</a></dt>
<dd><p>call several methods at once, return a list of (result, error) pairs</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>names</strong> – a list of method names</li>
<li><strong>*params</strong> – a list of (arg,kwarg) pairs corresponding to each method name</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="jsonrpc.proxy.JSONRPCProxy.call">
<tt class="descname">call</tt><big>(</big><em>method</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy.call" title="Permalink to this definition">¶</a></dt>
<dd><p>call a JSON-RPC method</p>
<p>It’s better to use instance.<methodname>(*args, **kwargs),
but this version might be useful occasionally</p>
</dd></dl>
<dl class="classmethod">
<dt id="jsonrpc.proxy.JSONRPCProxy.from_url">
<em class="property">classmethod </em><tt class="descname">from_url</tt><big>(</big><em>url</em>, <em>ctxid=None</em>, <em>serviceName=None</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#JSONRPCProxy.from_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.JSONRPCProxy.from_url" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a JSONRPCProxy from a URL</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="jsonrpc.proxy.ProxyEvents">
<em class="property">class </em><tt class="descclassname">jsonrpc.proxy.</tt><tt class="descname">ProxyEvents</tt><big>(</big><em>proxy</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#ProxyEvents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents" title="Permalink to this definition">¶</a></dt>
<dd><p>An event handler for JSONRPCProxy</p>
<p>Allow a subclass to do its own initialization, gets any arguments leftover from __init__</p>
<dl class="attribute">
<dt id="jsonrpc.proxy.ProxyEvents.IDGen">
<tt class="descname">IDGen</tt><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents.IDGen" title="Permalink to this definition">¶</a></dt>
<dd><p>an instance of a class which defines a __get__ method, used to generate a request id</p>
</dd></dl>
<dl class="method">
<dt id="jsonrpc.proxy.ProxyEvents.get_postdata">
<tt class="descname">get_postdata</tt><big>(</big><em>args</em>, <em>kwargs</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#ProxyEvents.get_postdata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents.get_postdata" title="Permalink to this definition">¶</a></dt>
<dd><p>allow a subclass to modify the method’s arguments</p>
<p>e.g. if an authentication token is necessary, the subclass can automatically insert it into every call</p>
</dd></dl>
<dl class="method">
<dt id="jsonrpc.proxy.ProxyEvents.proc_response">
<tt class="descname">proc_response</tt><big>(</big><em>data</em><big>)</big><a class="reference internal" href="_modules/jsonrpc/proxy.html#ProxyEvents.proc_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jsonrpc.proxy.ProxyEvents.proc_response" title="Permalink to this definition">¶</a></dt>
<dd><p>allow a subclass to access the response data before it is returned to the user</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="server.html"
title="previous chapter">JSON-RPC Server</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="jsonutil.html"
title="next chapter">jsonrpc.jsonutil</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/proxy.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="jsonutil.html" title="jsonrpc.jsonutil"
>next</a> |</li>
<li class="right" >
<a href="server.html" title="JSON-RPC Server"
>previous</a> |</li>
<li><a href="index.html">JSONRPC v1.0 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2011, Edward Langley.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
</div>
</body>
</html>
|