mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-30 15:04:18 +00:00
469 lines
No EOL
28 KiB
HTML
469 lines
No EOL
28 KiB
HTML
|
||
|
||
<!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 — 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> »</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>
|
||
<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="descclassname">royalnet.network.</code><code class="descname">RoyalnetLink</code><span class="sig-paren">(</span><em>master_uri: str</em>, <em>secret: str</em>, <em>link_type: str</em>, <em>request_handler</em>, <em>*</em>, <em>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">
|
||
<code class="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">
|
||
<code class="descname">identify</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → 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">
|
||
<code class="descname">receive</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → 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">
|
||
<code class="descname">request</code><span class="sig-paren">(</span><em>message</em>, <em>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">
|
||
<code class="descname">run</code><span class="sig-paren">(</span><em>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">
|
||
<code class="descname">send</code><span class="sig-paren">(</span><em>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="descclassname">royalnet.network.</code><code class="descname">NetworkError</code><span class="sig-paren">(</span><em>error_data: dict</em>, <em>*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="descclassname">royalnet.network.</code><code class="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="descclassname">royalnet.network.</code><code class="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="descclassname">royalnet.network.</code><code class="descname">Package</code><span class="sig-paren">(</span><em>data: dict</em>, <em>*</em>, <em>source: str</em>, <em>destination: str</em>, <em>source_conv_id: Optional[str] = None</em>, <em>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="descname">__init__</code><span class="sig-paren">(</span><em>data: dict</em>, <em>*</em>, <em>source: str</em>, <em>destination: str</em>, <em>source_conv_id: Optional[str] = None</em>, <em>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="staticmethod">
|
||
<dt id="royalnet.network.Package.from_dict">
|
||
<em class="property">static </em><code class="descname">from_dict</code><span class="sig-paren">(</span><em>d</em><span class="sig-paren">)</span> → 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="staticmethod">
|
||
<dt id="royalnet.network.Package.from_json_bytes">
|
||
<em class="property">static </em><code class="descname">from_json_bytes</code><span class="sig-paren">(</span><em>b: bytes</em><span class="sig-paren">)</span> → 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="staticmethod">
|
||
<dt id="royalnet.network.Package.from_json_string">
|
||
<em class="property">static </em><code class="descname">from_json_string</code><span class="sig-paren">(</span><em>string: str</em><span class="sig-paren">)</span> → 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="descname">reply</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span> → 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="descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → 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="descname">to_json_bytes</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → 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="descname">to_json_string</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → 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="descclassname">royalnet.network.</code><code class="descname">RoyalnetServer</code><span class="sig-paren">(</span><em>address: str</em>, <em>port: int</em>, <em>required_secret: str</em>, <em>*</em>, <em>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="descname">find_client</code><span class="sig-paren">(</span><em>*</em>, <em>nid: str = None</em>, <em>link_type: str = None</em><span class="sig-paren">)</span> → 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="descname">find_destination</code><span class="sig-paren">(</span><em>package: royalnet.network.package.Package</em><span class="sig-paren">)</span> → 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">
|
||
<code class="descname">listener</code><span class="sig-paren">(</span><em>websocket: websockets.server.WebSocketServerProtocol</em>, <em>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">
|
||
<code class="descname">route_package</code><span class="sig-paren">(</span><em>package: royalnet.network.package.Package</em><span class="sig-paren">)</span> → 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">
|
||
<code class="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">
|
||
<code class="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="descclassname">royalnet.network.</code><code class="descname">RoyalnetConfig</code><span class="sig-paren">(</span><em>master_uri: str</em>, <em>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="descclassname">royalnet.network.</code><code class="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 can’t be used anymore.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="class">
|
||
<dt id="royalnet.network.Request">
|
||
<em class="property">class </em><code class="descclassname">royalnet.network.</code><code class="descname">Request</code><span class="sig-paren">(</span><em>handler: str</em>, <em>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="staticmethod">
|
||
<dt id="royalnet.network.Request.from_dict">
|
||
<em class="property">static </em><code class="descname">from_dict</code><span class="sig-paren">(</span><em>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="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="descclassname">royalnet.network.</code><code class="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="classmethod">
|
||
<dt id="royalnet.network.Response.from_dict">
|
||
<em class="property">classmethod </em><code class="descname">from_dict</code><span class="sig-paren">(</span><em>d: dict</em><span class="sig-paren">)</span> → 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="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="descname">to_dict</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → 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="descclassname">royalnet.network.</code><code class="descname">ResponseSuccess</code><span class="sig-paren">(</span><em>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="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="descclassname">royalnet.network.</code><code class="descname">ResponseError</code><span class="sig-paren">(</span><em>name: str</em>, <em>description: str</em>, <em>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="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>
|
||
|
||
</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>
|
||
© 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> |