Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > by-pkgid > b9ca70a7484981df9126f0365edf0863 > files > 247

python-pyzmq-2.2.0.1-1mdv2010.1.i586.rpm



<!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>utils.jsonapi &mdash; PyZMQ v2.2.0.1 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:     '2.2.0.1',
        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="shortcut icon" href="../../_static/zeromq.ico"/>
    <link rel="top" title="PyZMQ v2.2.0.1 documentation" href="../../index.html" />
    <link rel="up" title="The PyZMQ API" href="../index.html" />
    <link rel="next" title="web.proxy" href="zmq.web.proxy.html" />
    <link rel="prev" title="ssh.tunnel" href="zmq.ssh.tunnel.html" /> 
  </head>
  <body>

<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="../../index.html"><img src="../../_static/logo.png" border="0" alt="PyZMQ Documentation"/></a>
</div>

    <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="zmq.web.proxy.html" title="web.proxy"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="zmq.ssh.tunnel.html" title="ssh.tunnel"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../index.html">API</a> &raquo;</li>

          <li><a href="../index.html" accesskey="U">The PyZMQ API</a> &raquo;</li> 
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">utils.jsonapi</a><ul>
<li><a class="reference internal" href="#module-zmq.utils.jsonapi">Module: <tt class="docutils literal"><span class="pre">utils.jsonapi</span></tt></a><ul>
<li><a class="reference internal" href="#authors">Authors</a></li>
</ul>
</li>
<li><a class="reference internal" href="#functions">Functions</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="zmq.ssh.tunnel.html"
                        title="previous chapter">ssh.tunnel</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="zmq.web.proxy.html"
                        title="next chapter">web.proxy</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/api/generated/zmq.utils.jsonapi.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="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="utils-jsonapi">
<h1>utils.jsonapi<a class="headerlink" href="#utils-jsonapi" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-zmq.utils.jsonapi">
<span id="module-utils-jsonapi"></span><h2>Module: <tt class="xref py py-mod docutils literal"><span class="pre">utils.jsonapi</span></tt><a class="headerlink" href="#module-zmq.utils.jsonapi" title="Permalink to this headline">¶</a></h2>
<p>Priority based json library imports.</p>
<p>Use jsonapi.loads() and jsonapi.dumps() for guaranteed symmetry.</p>
<p>Priority: simplejson &gt; jsonlib2 &gt; json</p>
<p>Always serializes to bytes instead of unicode for zeromq compatibility.</p>
<p>jsonapi.loads/dumps provide kwarg-compatibility with stdlib json.</p>
<p>To override pyzmq&#8217;s choice of json library, you can simply override the loads/dumps
methods, e.g.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">ujson</span>
<span class="kn">from</span> <span class="nn">zmq.utils</span> <span class="kn">import</span> <span class="n">jsonapi</span>
<span class="n">jsonapi</span><span class="o">.</span><span class="n">jsonmod</span> <span class="o">=</span> <span class="n">ujson</span>
<span class="c"># ujson doesn&#39;t support the `separators` kwarg we use, so force its own dumps:</span>
<span class="n">jsonapi</span><span class="o">.</span><span class="n">dumps</span> <span class="o">=</span> <span class="n">ujson</span><span class="o">.</span><span class="n">dumps</span>
</pre></div>
</div>
<p>To select the super-fast ujson module.  Note that using a different module such
as ujson that does not support the same kwargs as stdlib json may break
compatibility with other tools that depend on this, if used in the same process.
A safer route is to just serialize your own messages yourself with your favorite
library.</p>
<div class="section" id="authors">
<h3>Authors<a class="headerlink" href="#authors" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>MinRK</li>
<li>Brian Granger</li>
</ul>
</div>
</div>
<div class="section" id="functions">
<h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="zmq.utils.jsonapi.dumps">
<tt class="descclassname">zmq.utils.jsonapi.</tt><tt class="descname">dumps</tt><big>(</big><em>o</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#zmq.utils.jsonapi.dumps" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="zmq.utils.jsonapi.loads">
<tt class="descclassname">zmq.utils.jsonapi.</tt><tt class="descname">loads</tt><big>(</big><em>s</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#zmq.utils.jsonapi.loads" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div>
</div>


          </div>
        </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="zmq.web.proxy.html" title="web.proxy"
             >next</a> |</li>
        <li class="right" >
          <a href="zmq.ssh.tunnel.html" title="ssh.tunnel"
             >previous</a> |</li>
        <li><a href="../../index.html">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../index.html">API</a> &raquo;</li>

          <li><a href="../index.html" >The PyZMQ API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2010-2011, Brian E. Granger &amp; Min Ragan-Kelley.  
ØMQ logo © iMatix Corportation, used under the Creative Commons Attribution-Share Alike 3.0 License.  
Python logo ™ of the Python Software Foundation, used by Min RK with permission from the Foundation.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>