1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/docs/html/network.html

469 lines
29 KiB
HTML
Raw Normal View History

2019-06-13 15:36:27 +00:00
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>royalnet.network &mdash; Royalnet documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="royalnet.utils" href="utils.html" />
<link rel="prev" title="royalnet.database" href="database.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Royalnet
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="audio.html">royalnet.audio</a></li>
<li class="toctree-l1"><a class="reference internal" href="bots.html">royalnet.bots</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">royalnet.commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="database.html">royalnet.database</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">royalnet.network</a><ul class="simple">
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="utils.html">royalnet.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="error.html">royalnet.error</a></li>
<li class="toctree-l1"><a class="reference internal" href="web.html">royalnet.web</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Royalnet</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>royalnet.network</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/network.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="royalnet-network">
<h1>royalnet.network<a class="headerlink" href="#royalnet-network" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
2019-07-10 14:16:35 +00:00
<span class="target" id="module-royalnet.network"></span><p>Royalnet (websocket) related classes.</p>
<dl class="class">
<dt id="royalnet.network.RoyalnetLink">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">RoyalnetLink</code><span class="sig-paren">(</span><em class="sig-param">master_uri: str</em>, <em class="sig-param">secret: str</em>, <em class="sig-param">link_type: str</em>, <em class="sig-param">request_handler</em>, <em class="sig-param">*</em>, <em class="sig-param">loop: asyncio.events.AbstractEventLoop = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.network.RoyalnetLink.connect">
<em class="property">async </em><code class="sig-name descname">connect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink.connect" title="Permalink to this definition"></a></dt>
<dd><p>Connect to the <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a> at <code class="docutils literal notranslate"><span class="pre">self.master_uri</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetLink.identify">
<em class="property">async </em><code class="sig-name descname">identify</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.network.RoyalnetLink.identify" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetLink.receive">
<em class="property">async </em><code class="sig-name descname">receive</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; royalnet.network.package.Package<a class="headerlink" href="#royalnet.network.RoyalnetLink.receive" title="Permalink to this definition"></a></dt>
<dd><p>Recieve a <a class="reference internal" href="#royalnet.network.Package" title="royalnet.network.Package"><code class="xref py py-class docutils literal notranslate"><span class="pre">Package</span></code></a> from the <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>royalnet.network.royalnetlink.ConnectionClosedError</strong> </p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetLink.request">
<em class="property">async </em><code class="sig-name descname">request</code><span class="sig-paren">(</span><em class="sig-param">message</em>, <em class="sig-param">destination</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink.request" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetLink.run">
<em class="property">async </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param">loops: numbers.Real = inf</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink.run" title="Permalink to this definition"></a></dt>
<dd><p>Blockingly run the Link.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetLink.send">
<em class="property">async </em><code class="sig-name descname">send</code><span class="sig-paren">(</span><em class="sig-param">package: royalnet.network.package.Package</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetLink.send" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="royalnet.network.NetworkError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">NetworkError</code><span class="sig-paren">(</span><em class="sig-param">error_data: dict</em>, <em class="sig-param">*args</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.NetworkError" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="exception">
<dt id="royalnet.network.NotConnectedError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">NotConnectedError</code><a class="headerlink" href="#royalnet.network.NotConnectedError" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a> is not connected to a <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a>.</p>
</dd></dl>
<dl class="exception">
<dt id="royalnet.network.NotIdentifiedError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">NotIdentifiedError</code><a class="headerlink" href="#royalnet.network.NotIdentifiedError" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a> has not identified yet to a <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a>.</p>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.Package">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">Package</code><span class="sig-paren">(</span><em class="sig-param">data: dict</em>, <em class="sig-param">*</em>, <em class="sig-param">source: str</em>, <em class="sig-param">destination: str</em>, <em class="sig-param">source_conv_id: Optional[str] = None</em>, <em class="sig-param">destination_conv_id: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.Package" title="Permalink to this definition"></a></dt>
<dd><p>A Royalnet package, the data type with which a <a class="reference internal" href="#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a> communicates with a <a class="reference internal" href="#royalnet.network.RoyalnetServer" title="royalnet.network.RoyalnetServer"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetServer</span></code></a> or another link.
Contains info about the source and the destination.</p>
<dl class="method">
<dt id="royalnet.network.Package.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">data: dict</em>, <em class="sig-param">*</em>, <em class="sig-param">source: str</em>, <em class="sig-param">destination: str</em>, <em class="sig-param">source_conv_id: Optional[str] = None</em>, <em class="sig-param">destination_conv_id: Optional[str] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.Package.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Create a Package.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> The data that should be sent. Usually a <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.Message</span></code>.</p></li>
<li><p><strong>source</strong> The <code class="docutils literal notranslate"><span class="pre">nid</span></code> of the node that created this Package.</p></li>
<li><p><strong>destination</strong> The <code class="docutils literal notranslate"><span class="pre">link_type</span></code> of the destination node, or alternatively, the <code class="docutils literal notranslate"><span class="pre">nid</span></code> of the node. Can also be the <code class="docutils literal notranslate"><span class="pre">NULL</span></code> value to send the message to nobody.</p></li>
<li><p><strong>source_conv_id</strong> The conversation id of the node that created this package. Akin to the sequence number on IP packets.</p></li>
<li><p><strong>destination_conv_id</strong> The conversation id of the node that this Package is a reply to.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.from_dict">
<em class="property">static </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d</em><span class="sig-paren">)</span> &#x2192; royalnet.network.package.Package<a class="headerlink" href="#royalnet.network.Package.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Create a Package from a dictionary.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.from_json_bytes">
<em class="property">static </em><code class="sig-name descname">from_json_bytes</code><span class="sig-paren">(</span><em class="sig-param">b: bytes</em><span class="sig-paren">)</span> &#x2192; royalnet.network.package.Package<a class="headerlink" href="#royalnet.network.Package.from_json_bytes" title="Permalink to this definition"></a></dt>
<dd><p>Create a Package from UTF8-encoded JSON bytes.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.from_json_string">
<em class="property">static </em><code class="sig-name descname">from_json_string</code><span class="sig-paren">(</span><em class="sig-param">string: str</em><span class="sig-paren">)</span> &#x2192; royalnet.network.package.Package<a class="headerlink" href="#royalnet.network.Package.from_json_string" title="Permalink to this definition"></a></dt>
<dd><p>Create a Package from a JSON string.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.reply">
<code class="sig-name descname">reply</code><span class="sig-paren">(</span><em class="sig-param">data</em><span class="sig-paren">)</span> &#x2192; royalnet.network.package.Package<a class="headerlink" href="#royalnet.network.Package.reply" title="Permalink to this definition"></a></dt>
<dd><p>Reply to this Package with another Package.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> The data that should be sent. Usually a <code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.Message</span></code>.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The reply Package.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.network.Package.to_dict" title="Permalink to this definition"></a></dt>
<dd><p>Convert the Package into a dictionary.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.to_json_bytes">
<code class="sig-name descname">to_json_bytes</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; bytes<a class="headerlink" href="#royalnet.network.Package.to_json_bytes" title="Permalink to this definition"></a></dt>
<dd><p>Convert the Package into UTF8-encoded JSON bytes.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Package.to_json_string">
<code class="sig-name descname">to_json_string</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#royalnet.network.Package.to_json_string" title="Permalink to this definition"></a></dt>
<dd><p>Convert the Package into a JSON string.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.RoyalnetServer">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">RoyalnetServer</code><span class="sig-paren">(</span><em class="sig-param">address: str</em>, <em class="sig-param">port: int</em>, <em class="sig-param">required_secret: str</em>, <em class="sig-param">*</em>, <em class="sig-param">loop: asyncio.events.AbstractEventLoop = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetServer" title="Permalink to this definition"></a></dt>
<dd><dl class="method">
<dt id="royalnet.network.RoyalnetServer.find_client">
<code class="sig-name descname">find_client</code><span class="sig-paren">(</span><em class="sig-param">*</em>, <em class="sig-param">nid: str = None</em>, <em class="sig-param">link_type: str = None</em><span class="sig-paren">)</span> &#x2192; List[royalnet.network.royalnetserver.ConnectedClient]<a class="headerlink" href="#royalnet.network.RoyalnetServer.find_client" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetServer.find_destination">
<code class="sig-name descname">find_destination</code><span class="sig-paren">(</span><em class="sig-param">package: royalnet.network.package.Package</em><span class="sig-paren">)</span> &#x2192; List[royalnet.network.royalnetserver.ConnectedClient]<a class="headerlink" href="#royalnet.network.RoyalnetServer.find_destination" title="Permalink to this definition"></a></dt>
<dd><p>Find a list of destinations for the package.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>package</strong> The package to find the destination of.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#list" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a> of <code class="xref py py-class docutils literal notranslate"><span class="pre">ConnectedClients</span></code> to send the package to.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetServer.listener">
<em class="property">async </em><code class="sig-name descname">listener</code><span class="sig-paren">(</span><em class="sig-param">websocket: websockets.server.WebSocketServerProtocol</em>, <em class="sig-param">path</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetServer.listener" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetServer.route_package">
<em class="property">async </em><code class="sig-name descname">route_package</code><span class="sig-paren">(</span><em class="sig-param">package: royalnet.network.package.Package</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#royalnet.network.RoyalnetServer.route_package" title="Permalink to this definition"></a></dt>
<dd><p>Executed every time a package is received and must be routed somewhere.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetServer.serve">
<em class="property">async </em><code class="sig-name descname">serve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetServer.serve" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.network.RoyalnetServer.start">
<em class="property">async </em><code class="sig-name descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetServer.start" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.RoyalnetConfig">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">RoyalnetConfig</code><span class="sig-paren">(</span><em class="sig-param">master_uri: str</em>, <em class="sig-param">master_secret: str</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.RoyalnetConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="exception">
<dt id="royalnet.network.ConnectionClosedError">
<em class="property">exception </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">ConnectionClosedError</code><a class="headerlink" href="#royalnet.network.ConnectionClosedError" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a>s connection was closed unexpectedly. The link cant be used anymore.</p>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.Request">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">Request</code><span class="sig-paren">(</span><em class="sig-param">handler: str</em>, <em class="sig-param">data: dict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.Request" title="Permalink to this definition"></a></dt>
<dd><p>A request sent from a <a class="reference internal" href="#royalnet.network.RoyalnetLink" title="royalnet.network.RoyalnetLink"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.RoyalnetLink</span></code></a> to another.</p>
<p>It contains the name of the requested handler, in addition to the data.</p>
<dl class="method">
<dt id="royalnet.network.Request.from_dict">
<em class="property">static </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d: dict</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.Request.from_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="royalnet.network.Request.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.Request.to_dict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.Response">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">Response</code><a class="headerlink" href="#royalnet.network.Response" title="Permalink to this definition"></a></dt>
<dd><p>A base class to be inherited by all other response types.</p>
<dl class="method">
<dt id="royalnet.network.Response.from_dict">
<em class="property">classmethod </em><code class="sig-name descname">from_dict</code><span class="sig-paren">(</span><em class="sig-param">d: dict</em><span class="sig-paren">)</span> &#x2192; royalnet.network.response.Response<a class="headerlink" href="#royalnet.network.Response.from_dict" title="Permalink to this definition"></a></dt>
<dd><p>Recreate the response from a received <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Response.raise_on_error">
<code class="sig-name descname">raise_on_error</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.Response.raise_on_error" title="Permalink to this definition"></a></dt>
<dd><p>Raise an <a class="reference external" href="https://docs.python.org/3.7/library/exceptions.html#Exception" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a> if the Response is an error, do nothing otherwise.</p>
</dd></dl>
<dl class="method">
<dt id="royalnet.network.Response.to_dict">
<code class="sig-name descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#royalnet.network.Response.to_dict" title="Permalink to this definition"></a></dt>
<dd><p>Prepare the Response to be sent by converting it to a JSONable <a class="reference external" href="https://docs.python.org/3.7/library/stdtypes.html#dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.ResponseSuccess">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">ResponseSuccess</code><span class="sig-paren">(</span><em class="sig-param">data: Optional[dict] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.ResponseSuccess" title="Permalink to this definition"></a></dt>
<dd><p>A response to a successful <a class="reference internal" href="#royalnet.network.Request" title="royalnet.network.Request"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.Request</span></code></a>.</p>
<dl class="method">
<dt id="royalnet.network.ResponseSuccess.raise_on_error">
<code class="sig-name descname">raise_on_error</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.ResponseSuccess.raise_on_error" title="Permalink to this definition"></a></dt>
<dd><p>Raise an <a class="reference external" href="https://docs.python.org/3.7/library/exceptions.html#Exception" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a> if the Response is an error, do nothing otherwise.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="royalnet.network.ResponseError">
<em class="property">class </em><code class="sig-prename descclassname">royalnet.network.</code><code class="sig-name descname">ResponseError</code><span class="sig-paren">(</span><em class="sig-param">name: str</em>, <em class="sig-param">description: str</em>, <em class="sig-param">extra_info: Optional[dict] = None</em><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.ResponseError" title="Permalink to this definition"></a></dt>
<dd><p>A response to a invalid <a class="reference internal" href="#royalnet.network.Request" title="royalnet.network.Request"><code class="xref py py-class docutils literal notranslate"><span class="pre">royalnet.network.Request</span></code></a>.</p>
<dl class="method">
<dt id="royalnet.network.ResponseError.raise_on_error">
<code class="sig-name descname">raise_on_error</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#royalnet.network.ResponseError.raise_on_error" title="Permalink to this definition"></a></dt>
<dd><p>Raise an <a class="reference external" href="https://docs.python.org/3.7/library/exceptions.html#Exception" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a> if the Response is an error, do nothing otherwise.</p>
</dd></dl>
</dd></dl>
2019-06-13 15:36:27 +00:00
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="utils.html" class="btn btn-neutral float-right" title="royalnet.utils" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="database.html" class="btn btn-neutral float-left" title="royalnet.database" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2019, Stefano Pigozzi
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>