<!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>IRI Submodule — rfc3986 1.0.0 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="Miscellaneous Submodules" href="miscellaneous.html" /> <link rel="prev" title="Validators Submodule" href="validators.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"> rfc3986 </a> <div class="version"> 1.0.0 </div> <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"> <p class="caption"><span class="caption-text">Contents:</span></p> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../narrative.html">User Documentation</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">API Reference</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="api.html">API Submodule</a></li> <li class="toctree-l2"><a class="reference internal" href="builder.html">URI Builder Module</a></li> <li class="toctree-l2"><a class="reference internal" href="uri.html">URI Submodule</a></li> <li class="toctree-l2"><a class="reference internal" href="validators.html">Validators Submodule</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">IRI Submodule</a></li> <li class="toctree-l2"><a class="reference internal" href="miscellaneous.html">Miscellaneous Submodules</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../release-notes/index.html">Release Notes and History</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">rfc3986</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><a href="index.html">API Reference</a> »</li> <li>IRI Submodule</li> <li class="wy-breadcrumbs-aside"> <a href="../_sources/api-ref/iri.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="iri-submodule"> <h1>IRI Submodule<a class="headerlink" href="#iri-submodule" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="rfc3986.iri.IRIReference"> <em class="property">class </em><code class="descclassname">rfc3986.iri.</code><code class="descname">IRIReference</code><a class="headerlink" href="#rfc3986.iri.IRIReference" title="Permalink to this definition">¶</a></dt> <dd><p>Immutable object representing a parsed IRI Reference.</p> <p>Can be encoded into an URIReference object via the procedure specified in RFC 3987 Section 3.1</p> <blockquote> <div><div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The IRI submodule is a new interface and may possibly change in the future. Check for changes to the interface when upgrading.</p> </div> </div></blockquote> </dd></dl> <dl class="method"> <dt id="rfc3986.iri.IRIReference.encode"> <code class="descclassname">IRIReference.</code><code class="descname">encode</code><span class="sig-paren">(</span><em>idna_encoder=None</em><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.encode" title="Permalink to this definition">¶</a></dt> <dd><p>Encode an IRIReference into a URIReference instance.</p> <p>If the <code class="docutils literal notranslate"><span class="pre">idna</span></code> module is installed or the <code class="docutils literal notranslate"><span class="pre">rfc3986[idna]</span></code> extra is used then unicode characters in the IRI host component will be encoded with IDNA2008.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>idna_encoder</strong> – Function that encodes each part of the host component If not given will raise an exception if the IRI contains a host component.</td> </tr> <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="uri.html#rfc3986.uri.URIReference" title="rfc3986.uri.URIReference">uri.URIReference</a></td> </tr> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A URI reference</td> </tr> </tbody> </table> </dd></dl> <dl class="classmethod"> <dt id="rfc3986.iri.IRIReference.from_string"> <em class="property">classmethod </em><code class="descclassname">IRIReference.</code><code class="descname">from_string</code><span class="sig-paren">(</span><em>iri_string</em>, <em>encoding='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.from_string" title="Permalink to this definition">¶</a></dt> <dd><p>Parse a IRI reference from the given unicode IRI string.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>iri_string</strong> (<em>str</em>) – Unicode IRI to be parsed into a reference.</li> <li><strong>encoding</strong> (<em>str</em>) – The encoding of the string provided</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#rfc3986.iri.IRIReference" title="rfc3986.iri.IRIReference"><code class="xref py py-class docutils literal notranslate"><span class="pre">IRIReference</span></code></a> or subclass thereof</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="rfc3986.iri.IRIReference.unsplit"> <code class="descclassname">IRIReference.</code><code class="descname">unsplit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.unsplit" title="Permalink to this definition">¶</a></dt> <dd><p>Create a URI string from the components.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The URI Reference reconstituted as a string.</td> </tr> <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="rfc3986.iri.IRIReference.resolve_with"> <code class="descclassname">IRIReference.</code><code class="descname">resolve_with</code><span class="sig-paren">(</span><em>base_uri</em>, <em>strict=False</em><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.resolve_with" title="Permalink to this definition">¶</a></dt> <dd><p>Use an absolute URI Reference to resolve this relative reference.</p> <p>Assuming this is a relative reference that you would like to resolve, use the provided base URI to resolve it.</p> <p>See <a class="reference external" href="http://tools.ietf.org/html/rfc3986#section-5">http://tools.ietf.org/html/rfc3986#section-5</a> for more information.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>base_uri</strong> – Either a string or URIReference. It must be an absolute URI or it will raise an exception.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A new URIReference which is the result of resolving this reference using <code class="docutils literal notranslate"><span class="pre">base_uri</span></code>.</td> </tr> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><code class="xref py py-class docutils literal notranslate"><span class="pre">URIReference</span></code></td> </tr> <tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>rfc3986.exceptions.ResolutionError</strong> – If the <code class="docutils literal notranslate"><span class="pre">base_uri</span></code> is not an absolute URI.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="rfc3986.iri.IRIReference.copy_with"> <code class="descclassname">IRIReference.</code><code class="descname">copy_with</code><span class="sig-paren">(</span><em>scheme=<object object></em>, <em>authority=<object object></em>, <em>path=<object object></em>, <em>query=<object object></em>, <em>fragment=<object object></em><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.copy_with" title="Permalink to this definition">¶</a></dt> <dd><p>Create a copy of this reference with the new components.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>scheme</strong> (<em>str</em>) – (optional) The scheme to use for the new reference.</li> <li><strong>authority</strong> (<em>str</em>) – (optional) The authority to use for the new reference.</li> <li><strong>path</strong> (<em>str</em>) – (optional) The path to use for the new reference.</li> <li><strong>query</strong> (<em>str</em>) – (optional) The query to use for the new reference.</li> <li><strong>fragment</strong> (<em>str</em>) – (optional) The fragment to use for the new reference.</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">New URIReference with provided components.</p> </td> </tr> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="uri.html#rfc3986.uri.URIReference" title="rfc3986.uri.URIReference">URIReference</a></p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="rfc3986.iri.IRIReference.is_absolute"> <code class="descclassname">IRIReference.</code><code class="descname">is_absolute</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.is_absolute" title="Permalink to this definition">¶</a></dt> <dd><p>Determine if this URI Reference is an absolute URI.</p> <p>See <a class="reference external" href="http://tools.ietf.org/html/rfc3986#section-4.3">http://tools.ietf.org/html/rfc3986#section-4.3</a> for explanation.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><code class="docutils literal notranslate"><span class="pre">True</span></code> if it is an absolute URI, <code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.</td> </tr> <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="rfc3986.iri.IRIReference.authority_info"> <code class="descclassname">IRIReference.</code><code class="descname">authority_info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#rfc3986.iri.IRIReference.authority_info" title="Permalink to this definition">¶</a></dt> <dd><p>Return a dictionary with the <code class="docutils literal notranslate"><span class="pre">userinfo</span></code>, <code class="docutils literal notranslate"><span class="pre">host</span></code>, and <code class="docutils literal notranslate"><span class="pre">port</span></code>.</p> <p>If the authority is not valid, it will raise a <code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidAuthority</span></code> Exception.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><code class="docutils literal notranslate"><span class="pre">{'userinfo':</span> <span class="pre">'username:password',</span> <span class="pre">'host':</span> <span class="pre">'www.example.com',</span> <span class="pre">'port':</span> <span class="pre">'80'}</span></code></td> </tr> <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td> </tr> <tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><strong>rfc3986.exceptions.InvalidAuthority</strong> – If the authority is not <code class="docutils literal notranslate"><span class="pre">None</span></code> and can not be parsed.</td> </tr> </tbody> </table> </dd></dl> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="miscellaneous.html" class="btn btn-neutral float-right" title="Miscellaneous Submodules" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="validators.html" class="btn btn-neutral float-left" title="Validators Submodule" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2017, Ian Stapleton Cordasco </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>