<p><codeclass="docutils literal notranslate"><spanclass="pre">repo-autoindex</span></code> provides similar functionality to traditional server-generated
directory indexes such as httpd’s
<aclass="reference external"href="https://httpd.apache.org/docs/2.4/mod/mod_autoindex.html">mod_autoindex</a>, with
a few key differences:</p>
<ulclass="simple">
<li><p>The generated indexes are intentionally limited to show only the content present
in repository metadata, rather than all content within a directory.</p></li>
<li><p>The method of obtaining the content for indexing can be customized, allowing the
library to integrate with exotic scenarios such as repositories generated on demand
or not stored within a traditional filesystem.</p></li>
<p>* <codeclass="docutils literal notranslate"><spanclass="pre">repo-autoindex</span></code> supports kickstart tree repositories satisfying certain conditions:</p>
<ulclass="simple">
<li><p>The kickstart repo contains exactly one yum repo</p></li>
<li><p>The yum repo is located in the root of the kickstart tree repo, at exactly <codeclass="docutils literal notranslate"><spanclass="pre">.</span></code></p></li>
<h2><aclass="toc-backref"href="#id2"role="doc-backlink">Reference: CLI</a><aclass="headerlink"href="#reference-cli"title="Permalink to this heading">¶</a></h2>
<p><p>Generate indexes for a repository accessed via HTTP(S)</p>
<spanid="reference-api"></span><h2><aclass="toc-backref"href="#id3"role="doc-backlink">Reference: API</a><aclass="headerlink"href="#module-repo_autoindex"title="Permalink to this heading">¶</a></h2>
<emclass="property"><spanclass="pre">exception</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">repo_autoindex.</span></span><spanclass="sig-name descname"><spanclass="pre">ContentError</span></span><aclass="headerlink"href="#repo_autoindex.ContentError"title="Permalink to this definition">¶</a></dt>
<dd><p>An error raised when indexed content appears to be invalid.</p>
<p>Errors of this type are raised when repo-autoindex is able to successfully
retrieve content and determine a repository type but fails to parse
repository metadata. For example, a corrupt yum repository may cause this
<spanclass="sig-name descname"><spanclass="pre">content</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><aclass="reference external"href="https://docs.python.org/3/library/stdtypes.html#str"title="(in Python v3.12)"><spanclass="pre">str</span></a></em><aclass="headerlink"href="#repo_autoindex.GeneratedIndex.content"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">relative_dir</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><aclass="reference external"href="https://docs.python.org/3/library/stdtypes.html#str"title="(in Python v3.12)"><spanclass="pre">str</span></a></em><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">'.'</span></em><aclass="headerlink"href="#repo_autoindex.GeneratedIndex.relative_dir"title="Permalink to this definition">¶</a></dt>
<li><p><strong>url</strong>– Base URL of repository to be indexed. The function will probe this URL
for all supported repository types.</p></li>
<li><p><strong>fetcher</strong>–<p>An optional callable to customize the retrieval method for content in the
repository. Can be omitted to use a basic HTTP(S) fetcher.</p>
<p>A valid implementation must satisfy this contract:</p>
<ul>
<li><p>it will be called with the absolute URL of content which may or may not exist
within the repository (e.g.
“<aclass="reference external"href="https://example.com/some-yum-repo/repodata/repomd.xml">https://example.com/some-yum-repo/repodata/repomd.xml</a>” when probing a yum
repository)</p></li>
<li><p>if the fetcher can determine, without error, that the requested content does not
exist: it must return <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
<li><p>if the fetcher encounters an exception, it may allow the exception to
propagate.</p></li>
</ul>
</p></li>
<li><p><strong>index_href_suffix</strong>–<p>Suffix added onto any links between one generated index and another.</p>
<p>For example, if the caller intends to save each generated index page as
autoindex.html, then <codeclass="docutils literal notranslate"><spanclass="pre">index_href_suffix="autoindex.html"</span></code> should be passed
so that any links between one index and another will use a correct URL.</p>
<p>On the other hand, if the caller intends to save each generated index page
as index.html and serve them via a web server which automatically serves
files named index.html within each directory, the suffix can be left
<ddclass="field-even"><p><p>An async generator producing zero or more instances of <aclass="reference internal"href="#repo_autoindex.GeneratedIndex"title="repo_autoindex.GeneratedIndex"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">GeneratedIndex</span></code></a>.</p>
<p>Zero indexes may be produced if the given URL doesn’t represent a repository
<li><p><aclass="reference internal"href="#repo_autoindex.ContentError"title="repo_autoindex.ContentError"><strong>ContentError</strong></a>– Raised if indexed content appears to be invalid (for example, a yum repository
<li><p><aclass="reference external"href="https://docs.python.org/3/library/exceptions.html#Exception"title="(in Python v3.12)"><strong>Exception</strong></a>– Any exception raised by <codeclass="docutils literal notranslate"><spanclass="pre">fetcher</span></code> will propagate (for example, I/O errors or