Deployed ac7d10ab with MkDocs version: 1.6.1

This commit is contained in:
2026-11-30 16:51:01 +00:00
parent 2f4b8a9e17
commit 5d4f659f8b
5 changed files with 409 additions and 398 deletions
+3 -2
View File
@@ -2517,13 +2517,14 @@ Click <code>cli</code> entry point plus three abstract methods.</p>
</table> </table>
<p><code>GEOFENCE</code> drives an automatic proxy: on startup, if you did not pass an <p><code>GEOFENCE</code> drives an automatic proxy: on startup, if you did not pass an
explicit <code>--proxy</code>, the base class does a live IP check and, if your region is explicit <code>--proxy</code>, the base class does a live IP check and, if your region is
blocked, fetches a proxy to <code>GEOFENCE[0]</code> from your configured proxy providers.</p> blocked, fetches a proxy to <code>GEOFENCE[0]</code> from your configured proxy providers. A
proxy exit outside <code>GEOFENCE</code> logs a warning and the run continues.</p>
<p><code>GEOBLOCK</code> is the negative form: the service works everywhere except the listed <p><code>GEOBLOCK</code> is the negative form: the service works everywhere except the listed
regions. With no <code>GEOFENCE</code> to name a main region, a <code>GEOBLOCK</code> hit stops the run regions. With no <code>GEOFENCE</code> to name a main region, a <code>GEOBLOCK</code> hit stops the run
with a "not available in your region" error; pass <code>--proxy</code> yourself.</p> with a "not available in your region" error; pass <code>--proxy</code> yourself.</p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="k">class</span><span class="w"> </span><span class="nc">EXAMPLE</span><span class="p">(</span><span class="n">Service</span><span class="p">):</span> <div class="language-python highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="k">class</span><span class="w"> </span><span class="nc">EXAMPLE</span><span class="p">(</span><span class="n">Service</span><span class="p">):</span>
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a> <span class="n">ALIASES</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"EX"</span><span class="p">,</span> <span class="s2">"DOMAIN"</span><span class="p">)</span> </span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a> <span class="n">ALIASES</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"EX"</span><span class="p">,</span> <span class="s2">"DOMAIN"</span><span class="p">)</span>
</span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a> <span class="n">GEOFENCE</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"US"</span><span class="p">,</span> <span class="s2">"UK"</span><span class="p">)</span> </span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a> <span class="n">GEOFENCE</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"US"</span><span class="p">,</span> <span class="s2">"GB"</span><span class="p">)</span>
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a> <span class="n">VAULT_TAG</span> <span class="o">=</span> <span class="s2">"DIFFERENT_NAME"</span> </span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a> <span class="n">VAULT_TAG</span> <span class="o">=</span> <span class="s2">"DIFFERENT_NAME"</span>
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a> </span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a>
</span><span id="__span-3-6"><a id="__codelineno-3-6" name="__codelineno-3-6" href="#__codelineno-3-6"></a> </span><span id="__span-3-6"><a id="__codelineno-3-6" name="__codelineno-3-6" href="#__codelineno-3-6"></a>
+2 -1
View File
@@ -2852,7 +2852,8 @@ resolved through the per-service <code>proxy_map</code>, and, if <code>GEOFENCE<
IP check and auto-fetches a proxy to <code>GEOFENCE[0]</code> when it detects a geoblock. A IP check and auto-fetches a proxy to <code>GEOFENCE[0]</code> when it detects a geoblock. A
<code>GEOBLOCK</code> hit with no <code>GEOFENCE</code> stops the run with a "not available in your region" <code>GEOBLOCK</code> hit with no <code>GEOFENCE</code> stops the run with a "not available in your region"
error, because there is no main region to fetch a proxy for; pass <code>--proxy</code> yourself. error, because there is no main region to fetch a proxy for; pass <code>--proxy</code> yourself.
A proxy whose exit is in a <code>GEOBLOCK</code> region stops the run the same way. A proxy whose exit is in a <code>GEOBLOCK</code> region stops the run the same way. A proxy whose exit is
outside <code>GEOFENCE</code> logs a warning and the run continues.
See <a href="../../guide/proxies-and-vpn/">Proxies and VPN</a>.</p> See <a href="../../guide/proxies-and-vpn/">Proxies and VPN</a>.</p>
<div class="admonition note"> <div class="admonition note">
<p class="admonition-title"><code>TrackRequest</code></p> <p class="admonition-title"><code>TrackRequest</code></p>
+3 -2
View File
@@ -2993,8 +2993,9 @@ proxy. The service stops with <code>Proxy check failed</code> in two cases:</p>
<p>unshackle tries each geolocation API in turn, and a 429 moves on to the next one. If at <p>unshackle tries each geolocation API in turn, and a 429 moves on to the next one. If at
least one API answers through the proxy but none of them gives an IP, the proxy passes least one API answers through the proxy but none of them gives an IP, the proxy passes
the check without the IP comparison. unshackle does not compare the exit country with the region you asked for, the check without the IP comparison. unshackle does not compare the exit country with the region you asked for,
because geolocation data can be out of date.</p> because geolocation data can be out of date. When the service lists the regions it supports and
<p>Over the REST API, the server returns this failure to the client as <code>INVALID_PROXY</code>.</p> the proxy exit is in none of them, unshackle logs a warning and continues.</p>
<p>Over the REST API, the server returns a <code>Proxy check failed</code> error to the client as <code>INVALID_PROXY</code>.</p>
<h3 id="system-proxy-and-environment-variables">System proxy and environment variables<a class="headerlink" href="#system-proxy-and-environment-variables" title="Permanent link">&para;</a></h3> <h3 id="system-proxy-and-environment-variables">System proxy and environment variables<a class="headerlink" href="#system-proxy-and-environment-variables" title="Permanent link">&para;</a></h3>
<p><code>--proxy</code> takes priority over the <code>HTTP_PROXY</code> and <code>HTTPS_PROXY</code> environment variables <p><code>--proxy</code> takes priority over the <code>HTTP_PROXY</code> and <code>HTTPS_PROXY</code> environment variables
and over the Windows system proxy. unshackle still reads a <code>REQUESTS_CA_BUNDLE</code> or and over the Windows system proxy. unshackle still reads a <code>REQUESTS_CA_BUNDLE</code> or
+400 -392
View File
@@ -3166,7 +3166,11 @@ still, during track download.</p>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-254">254</a></span> <span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-254">254</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-255">255</a></span> <span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-255">255</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-256">256</a></span> <span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-256">256</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-257">257</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service--source--__span-0-160"><a id="unshackle.core.service.Service--source--__codelineno-0-160" name="unshackle.core.service.Service--source--__codelineno-0-160"></a><span class="k">def</span><span class="w"> </span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">:</span> <span class="n">click</span><span class="o">.</span><span class="n">Context</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-257">257</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-258">258</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-259">259</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-260">260</a></span>
<span class="normal"><a href="#unshackle.core.service.Service--source--__codelineno-0-261">261</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service--source--__span-0-160"><a id="unshackle.core.service.Service--source--__codelineno-0-160" name="unshackle.core.service.Service--source--__codelineno-0-160"></a><span class="k">def</span><span class="w"> </span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctx</span><span class="p">:</span> <span class="n">click</span><span class="o">.</span><span class="n">Context</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service--source--__span-0-161"><a id="unshackle.core.service.Service--source--__codelineno-0-161" name="unshackle.core.service.Service--source--__codelineno-0-161"></a> <span class="n">console</span><span class="o">.</span><span class="n">print</span><span class="p">(</span><span class="n">Padding</span><span class="p">(</span><span class="n">Rule</span><span class="p">(</span><span class="sa">f</span><span class="s2">"[rule.text]Service: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)))</span> </span><span id="unshackle.core.service.Service--source--__span-0-161"><a id="unshackle.core.service.Service--source--__codelineno-0-161" name="unshackle.core.service.Service--source--__codelineno-0-161"></a> <span class="n">console</span><span class="o">.</span><span class="n">print</span><span class="p">(</span><span class="n">Padding</span><span class="p">(</span><span class="n">Rule</span><span class="p">(</span><span class="sa">f</span><span class="s2">"[rule.text]Service: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)))</span>
</span><span id="unshackle.core.service.Service--source--__span-0-162"><a id="unshackle.core.service.Service--source--__codelineno-0-162" name="unshackle.core.service.Service--source--__codelineno-0-162"></a> </span><span id="unshackle.core.service.Service--source--__span-0-162"><a id="unshackle.core.service.Service--source--__codelineno-0-162" name="unshackle.core.service.Service--source--__codelineno-0-162"></a>
</span><span id="unshackle.core.service.Service--source--__span-0-163"><a id="unshackle.core.service.Service--source--__codelineno-0-163" name="unshackle.core.service.Service--source--__codelineno-0-163"></a> <span class="bp">self</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="n">ctx</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">config</span> </span><span id="unshackle.core.service.Service--source--__span-0-163"><a id="unshackle.core.service.Service--source--__codelineno-0-163" name="unshackle.core.service.Service--source--__codelineno-0-163"></a> <span class="bp">self</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="n">ctx</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">config</span>
@@ -3244,26 +3248,30 @@ still, during track download.</p>
</span><span id="unshackle.core.service.Service--source--__span-0-235"><a id="unshackle.core.service.Service--source--__codelineno-0-235" name="unshackle.core.service.Service--source--__codelineno-0-235"></a> <span class="c1"># plaintext-http forward-proxy requests with HTTP 407.</span> </span><span id="unshackle.core.service.Service--source--__span-0-235"><a id="unshackle.core.service.Service--source--__codelineno-0-235" name="unshackle.core.service.Service--source--__codelineno-0-235"></a> <span class="c1"># plaintext-http forward-proxy requests with HTTP 407.</span>
</span><span id="unshackle.core.service.Service--source--__span-0-236"><a id="unshackle.core.service.Service--source--__codelineno-0-236" name="unshackle.core.service.Service--source--__codelineno-0-236"></a> <span class="c1"># Verify the proxy IP every time, because a proxy can change its exit node. A dead</span> </span><span id="unshackle.core.service.Service--source--__span-0-236"><a id="unshackle.core.service.Service--source--__codelineno-0-236" name="unshackle.core.service.Service--source--__codelineno-0-236"></a> <span class="c1"># Verify the proxy IP every time, because a proxy can change its exit node. A dead</span>
</span><span id="unshackle.core.service.Service--source--__span-0-237"><a id="unshackle.core.service.Service--source--__codelineno-0-237" name="unshackle.core.service.Service--source--__codelineno-0-237"></a> <span class="c1"># proxy fails here, not after every service request has used up its retries.</span> </span><span id="unshackle.core.service.Service--source--__span-0-237"><a id="unshackle.core.service.Service--source--__codelineno-0-237" name="unshackle.core.service.Service--source--__codelineno-0-237"></a> <span class="c1"># proxy fails here, not after every service request has used up its retries.</span>
</span><span id="unshackle.core.service.Service--source--__span-0-238"><a id="unshackle.core.service.Service--source--__codelineno-0-238" name="unshackle.core.service.Service--source--__codelineno-0-238"></a> <span class="n">exit_region</span> <span class="o">=</span> <span class="n">verify_proxy_exit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"country"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service--source--__span-0-238"><a id="unshackle.core.service.Service--source--__codelineno-0-238" name="unshackle.core.service.Service--source--__codelineno-0-238"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="o">=</span> <span class="n">verify_proxy_exit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"country"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service--source--__span-0-239"><a id="unshackle.core.service.Service--source--__codelineno-0-239" name="unshackle.core.service.Service--source--__codelineno-0-239"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="o">=</span> <span class="n">exit_region</span> </span><span id="unshackle.core.service.Service--source--__span-0-239"><a id="unshackle.core.service.Service--source--__codelineno-0-239" name="unshackle.core.service.Service--source--__codelineno-0-239"></a> <span class="n">region</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="ow">or</span> <span class="s2">""</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service--source--__span-0-240"><a id="unshackle.core.service.Service--source--__codelineno-0-240" name="unshackle.core.service.Service--source--__codelineno-0-240"></a> <span class="c1"># Only GEOBLOCK applies here: an explicit --proxy outside GEOFENCE stays the user's call.</span> </span><span id="unshackle.core.service.Service--source--__span-0-240"><a id="unshackle.core.service.Service--source--__codelineno-0-240" name="unshackle.core.service.Service--source--__codelineno-0-240"></a> <span class="n">blocked</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">GEOBLOCK</span> <span class="ow">or</span> <span class="p">()]</span>
</span><span id="unshackle.core.service.Service--source--__span-0-241"><a id="unshackle.core.service.Service--source--__codelineno-0-241" name="unshackle.core.service.Service--source--__codelineno-0-241"></a> <span class="k">if</span> <span class="n">exit_region</span> <span class="ow">and</span> <span class="nb">any</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">exit_region</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">GEOBLOCK</span><span class="p">):</span> </span><span id="unshackle.core.service.Service--source--__span-0-241"><a id="unshackle.core.service.Service--source--__codelineno-0-241" name="unshackle.core.service.Service--source--__codelineno-0-241"></a> <span class="k">if</span> <span class="n">region</span> <span class="ow">and</span> <span class="n">region</span> <span class="ow">in</span> <span class="n">blocked</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service--source--__span-0-242"><a id="unshackle.core.service.Service--source--__codelineno-0-242" name="unshackle.core.service.Service--source--__codelineno-0-242"></a> <span class="k">raise</span> <span class="n">coded</span><span class="p">(</span> </span><span id="unshackle.core.service.Service--source--__span-0-242"><a id="unshackle.core.service.Service--source--__codelineno-0-242" name="unshackle.core.service.Service--source--__codelineno-0-242"></a> <span class="k">raise</span> <span class="n">coded</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service--source--__span-0-243"><a id="unshackle.core.service.Service--source--__codelineno-0-243" name="unshackle.core.service.Service--source--__codelineno-0-243"></a> <span class="n">click</span><span class="o">.</span><span class="n">ClickException</span><span class="p">(</span> </span><span id="unshackle.core.service.Service--source--__span-0-243"><a id="unshackle.core.service.Service--source--__codelineno-0-243" name="unshackle.core.service.Service--source--__codelineno-0-243"></a> <span class="n">click</span><span class="o">.</span><span class="n">ClickException</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Service is not available in </span><span class="si">{</span><span class="n">whose</span><span class="si">}</span><span class="s2"> proxy's region (</span><span class="si">{</span><span class="n">region</span><span class="si">}</span><span class="s2">)"</span><span class="p">),</span>
</span><span id="unshackle.core.service.Service--source--__span-0-244"><a id="unshackle.core.service.Service--source--__codelineno-0-244" name="unshackle.core.service.Service--source--__codelineno-0-244"></a> <span class="sa">f</span><span class="s2">"Service is not available in </span><span class="si">{</span><span class="n">whose</span><span class="si">}</span><span class="s2"> proxy's region (</span><span class="si">{</span><span class="n">exit_region</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> </span><span id="unshackle.core.service.Service--source--__span-0-244"><a id="unshackle.core.service.Service--source--__codelineno-0-244" name="unshackle.core.service.Service--source--__codelineno-0-244"></a> <span class="n">APIErrorCode</span><span class="o">.</span><span class="n">GEOFENCE</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service--source--__span-0-245"><a id="unshackle.core.service.Service--source--__codelineno-0-245" name="unshackle.core.service.Service--source--__codelineno-0-245"></a> <span class="p">),</span> </span><span id="unshackle.core.service.Service--source--__span-0-245"><a id="unshackle.core.service.Service--source--__codelineno-0-245" name="unshackle.core.service.Service--source--__codelineno-0-245"></a> <span class="p">)</span>
</span><span id="unshackle.core.service.Service--source--__span-0-246"><a id="unshackle.core.service.Service--source--__codelineno-0-246" name="unshackle.core.service.Service--source--__codelineno-0-246"></a> <span class="n">APIErrorCode</span><span class="o">.</span><span class="n">GEOFENCE</span><span class="p">,</span> </span><span id="unshackle.core.service.Service--source--__span-0-246"><a id="unshackle.core.service.Service--source--__codelineno-0-246" name="unshackle.core.service.Service--source--__codelineno-0-246"></a> <span class="c1"># Warn only: the proxy is the user's call. Not is_region_allowed: self.GEOFENCE can be set per instance.</span>
</span><span id="unshackle.core.service.Service--source--__span-0-247"><a id="unshackle.core.service.Service--source--__codelineno-0-247" name="unshackle.core.service.Service--source--__codelineno-0-247"></a> <span class="p">)</span> </span><span id="unshackle.core.service.Service--source--__span-0-247"><a id="unshackle.core.service.Service--source--__codelineno-0-247" name="unshackle.core.service.Service--source--__codelineno-0-247"></a> <span class="n">fence</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">GEOFENCE</span> <span class="ow">or</span> <span class="p">()</span> <span class="k">if</span> <span class="n">x</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">blocked</span><span class="p">]</span>
</span><span id="unshackle.core.service.Service--source--__span-0-248"><a id="unshackle.core.service.Service--source--__codelineno-0-248" name="unshackle.core.service.Service--source--__codelineno-0-248"></a> <span class="k">else</span><span class="p">:</span> </span><span id="unshackle.core.service.Service--source--__span-0-248"><a id="unshackle.core.service.Service--source--__codelineno-0-248" name="unshackle.core.service.Service--source--__codelineno-0-248"></a> <span class="k">if</span> <span class="n">region</span> <span class="ow">and</span> <span class="n">fence</span> <span class="ow">and</span> <span class="n">region</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">fence</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service--source--__span-0-249"><a id="unshackle.core.service.Service--source--__codelineno-0-249" name="unshackle.core.service.Service--source--__codelineno-0-249"></a> <span class="c1"># No proxy, use cached IP info for title caching (non-critical)</span> </span><span id="unshackle.core.service.Service--source--__span-0-249"><a id="unshackle.core.service.Service--source--__codelineno-0-249" name="unshackle.core.service.Service--source--__codelineno-0-249"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service--source--__span-0-250"><a id="unshackle.core.service.Service--source--__codelineno-0-250" name="unshackle.core.service.Service--source--__codelineno-0-250"></a> <span class="k">try</span><span class="p">:</span> </span><span id="unshackle.core.service.Service--source--__span-0-250"><a id="unshackle.core.service.Service--source--__codelineno-0-250" name="unshackle.core.service.Service--source--__codelineno-0-250"></a> <span class="sa">f</span><span class="s2">"Proxy exit region </span><span class="si">{</span><span class="n">region</span><span class="si">}</span><span class="s2"> is outside the regions of the service (</span><span class="si">{</span><span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">fence</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span>
</span><span id="unshackle.core.service.Service--source--__span-0-251"><a id="unshackle.core.service.Service--source--__codelineno-0-251" name="unshackle.core.service.Service--source--__codelineno-0-251"></a> <span class="n">ip_info</span> <span class="o">=</span> <span class="n">get_ip_info</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">,</span> <span class="n">cached</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> </span><span id="unshackle.core.service.Service--source--__span-0-251"><a id="unshackle.core.service.Service--source--__codelineno-0-251" name="unshackle.core.service.Service--source--__codelineno-0-251"></a> <span class="p">)</span>
</span><span id="unshackle.core.service.Service--source--__span-0-252"><a id="unshackle.core.service.Service--source--__codelineno-0-252" name="unshackle.core.service.Service--source--__codelineno-0-252"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="o">=</span> <span class="n">ip_info</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"country"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">if</span> <span class="n">ip_info</span> <span class="k">else</span> <span class="kc">None</span> </span><span id="unshackle.core.service.Service--source--__span-0-252"><a id="unshackle.core.service.Service--source--__codelineno-0-252" name="unshackle.core.service.Service--source--__codelineno-0-252"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service--source--__span-0-253"><a id="unshackle.core.service.Service--source--__codelineno-0-253" name="unshackle.core.service.Service--source--__codelineno-0-253"></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> </span><span id="unshackle.core.service.Service--source--__span-0-253"><a id="unshackle.core.service.Service--source--__codelineno-0-253" name="unshackle.core.service.Service--source--__codelineno-0-253"></a> <span class="c1"># No proxy, use cached IP info for title caching (non-critical)</span>
</span><span id="unshackle.core.service.Service--source--__span-0-254"><a id="unshackle.core.service.Service--source--__codelineno-0-254" name="unshackle.core.service.Service--source--__codelineno-0-254"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Failed to get cached IP info: </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service--source--__span-0-254"><a id="unshackle.core.service.Service--source--__codelineno-0-254" name="unshackle.core.service.Service--source--__codelineno-0-254"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service--source--__span-0-255"><a id="unshackle.core.service.Service--source--__codelineno-0-255" name="unshackle.core.service.Service--source--__codelineno-0-255"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="o">=</span> <span class="kc">None</span> </span><span id="unshackle.core.service.Service--source--__span-0-255"><a id="unshackle.core.service.Service--source--__codelineno-0-255" name="unshackle.core.service.Service--source--__codelineno-0-255"></a> <span class="n">ip_info</span> <span class="o">=</span> <span class="n">get_ip_info</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">,</span> <span class="n">cached</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service--source--__span-0-256"><a id="unshackle.core.service.Service--source--__codelineno-0-256" name="unshackle.core.service.Service--source--__codelineno-0-256"></a> </span><span id="unshackle.core.service.Service--source--__span-0-256"><a id="unshackle.core.service.Service--source--__codelineno-0-256" name="unshackle.core.service.Service--source--__codelineno-0-256"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="o">=</span> <span class="n">ip_info</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"country"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">if</span> <span class="n">ip_info</span> <span class="k">else</span> <span class="kc">None</span>
</span><span id="unshackle.core.service.Service--source--__span-0-257"><a id="unshackle.core.service.Service--source--__codelineno-0-257" name="unshackle.core.service.Service--source--__codelineno-0-257"></a> <span class="n">run_proxy</span><span class="o">.</span><span class="n">watch</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="p">),</span> <span class="n">run_proxy</span><span class="o">.</span><span class="n">proxy_of</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">))</span> </span><span id="unshackle.core.service.Service--source--__span-0-257"><a id="unshackle.core.service.Service--source--__codelineno-0-257" name="unshackle.core.service.Service--source--__codelineno-0-257"></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service--source--__span-0-258"><a id="unshackle.core.service.Service--source--__codelineno-0-258" name="unshackle.core.service.Service--source--__codelineno-0-258"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Failed to get cached IP info: </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service--source--__span-0-259"><a id="unshackle.core.service.Service--source--__codelineno-0-259" name="unshackle.core.service.Service--source--__codelineno-0-259"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_region</span> <span class="o">=</span> <span class="kc">None</span>
</span><span id="unshackle.core.service.Service--source--__span-0-260"><a id="unshackle.core.service.Service--source--__codelineno-0-260" name="unshackle.core.service.Service--source--__codelineno-0-260"></a>
</span><span id="unshackle.core.service.Service--source--__span-0-261"><a id="unshackle.core.service.Service--source--__codelineno-0-261" name="unshackle.core.service.Service--source--__codelineno-0-261"></a> <span class="n">run_proxy</span><span class="o">.</span><span class="n">watch</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="p">),</span> <span class="n">run_proxy</span><span class="o">.</span><span class="n">proxy_of</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">))</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
@@ -3375,29 +3383,29 @@ still, during track download.</p>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-264">264</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-268">268</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-265">265</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-266">266</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-267">267</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-268">268</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-269">269</a></span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-269">269</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-270">270</a></span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-270">270</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-271">271</a></span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-271">271</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-272">272</a></span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-272">272</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-273">273</a></span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-273">273</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-274">274</a></span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-274">274</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-275">275</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-264"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-264" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-264"></a><span class="nd">@classmethod</span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-275">275</a></span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-265"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-265" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-265"></a><span class="k">def</span><span class="w"> </span><span class="nf">is_region_allowed</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">region</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-276">276</a></span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-266"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-266" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-266"></a><span class="w"> </span><span class="sd">"""True when an exit IP in `region` (two-letter region code, any case) can use the service.</span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-277">277</a></span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-267"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-267" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-267"></a> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-278">278</a></span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-268"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-268" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-268"></a><span class="sd"> An unknown region (None or empty) is allowed, because there is nothing to compare.</span> <span class="normal"><a href="#unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-279">279</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-268"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-268" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-268"></a><span class="nd">@classmethod</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-269"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-269" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-269"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-269"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-269" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-269"></a><span class="k">def</span><span class="w"> </span><span class="nf">is_region_allowed</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">region</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-270"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-270" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-270"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">region</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-270"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-270" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-270"></a><span class="w"> </span><span class="sd">"""True when an exit IP in `region` (two-letter region code, any case) can use the service.</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-271"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-271" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-271"></a> <span class="k">return</span> <span class="kc">True</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-271"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-271" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-271"></a>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-272"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-272" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-272"></a> <span class="n">region</span> <span class="o">=</span> <span class="n">region</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-272"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-272" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-272"></a><span class="sd"> An unknown region (None or empty) is allowed, because there is nothing to compare.</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-273"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-273" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-273"></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">region</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">GEOBLOCK</span><span class="p">):</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-273"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-273" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-273"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-274"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-274" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-274"></a> <span class="k">return</span> <span class="kc">False</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-274"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-274" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-274"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">region</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-275"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-275" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-275"></a> <span class="k">return</span> <span class="ow">not</span> <span class="bp">cls</span><span class="o">.</span><span class="n">GEOFENCE</span> <span class="ow">or</span> <span class="nb">any</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">region</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">GEOFENCE</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-275"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-275" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-275"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-276"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-276" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-276"></a> <span class="n">region</span> <span class="o">=</span> <span class="n">region</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-277"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-277" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-277"></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">region</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">GEOBLOCK</span><span class="p">):</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-278"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-278" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-278"></a> <span class="k">return</span> <span class="kc">False</span>
</span><span id="unshackle.core.service.Service.is_region_allowed--source--__span-0-279"><a id="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-279" name="unshackle.core.service.Service.is_region_allowed--source--__codelineno-0-279"></a> <span class="k">return</span> <span class="ow">not</span> <span class="bp">cls</span><span class="o">.</span><span class="n">GEOFENCE</span> <span class="ow">or</span> <span class="nb">any</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">region</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">GEOFENCE</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -3479,11 +3487,7 @@ then merges the DV tracks into the HDR10 result. With no DV video and
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-277">277</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-281">281</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-278">278</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-279">279</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-280">280</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-281">281</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-282">282</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-282">282</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-283">283</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-283">283</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-284">284</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-284">284</a></span>
@@ -3559,87 +3563,91 @@ then merges the DV tracks into the HDR10 result. With no DV video and
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-354">354</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-354">354</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-355">355</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-355">355</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-356">356</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-356">356</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-357">357</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-277"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-277" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-277"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_tracks_for_variants</span><span class="p">(</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-357">357</a></span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-278"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-278" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-278"></a> <span class="bp">self</span><span class="p">,</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-358">358</a></span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-279"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-279" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-279"></a> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">,</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-359">359</a></span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-280"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-280" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-280"></a> <span class="n">fetch_fn</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">Tracks</span><span class="p">],</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-360">360</a></span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-281"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-281" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-281"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Tracks</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-361">361</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-281"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-281" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-281"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_tracks_for_variants</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-282"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-282" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-282"></a><span class="w"> </span><span class="sd">"""Call fetch_fn for each codec/range combo in track_request, merge results.</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-282"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-282" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-282"></a> <span class="bp">self</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-283"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-283" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-283"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-283"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-283" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-283"></a> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-284"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-284" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-284"></a><span class="sd"> Video, audio and subtitles merge from every combo, so a track that only one manifest</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-284"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-284" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-284"></a> <span class="n">fetch_fn</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="n">Tracks</span><span class="p">],</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-285"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-285" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-285"></a><span class="sd"> offers is kept. The helper skips a later track whose ``Tracks.signature`` matches a held</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-285"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-285" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-285"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Tracks</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-286"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-286" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-286"></a><span class="sd"> one, because its ID can differ between manifests. Chapters and attachments come from the</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-286"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-286" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-286"></a><span class="w"> </span><span class="sd">"""Call fetch_fn for each codec/range combo in track_request, merge results.</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-287"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-287" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-287"></a><span class="sd"> first combo only.</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-287"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-287" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-287"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-288"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-288" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-288"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-288"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-288" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-288"></a><span class="sd"> Video, audio and subtitles merge from every combo, so a track that only one manifest</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-289"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-289" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-289"></a><span class="sd"> Services that need separate API calls per codec/range combo can use this</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-289"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-289" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-289"></a><span class="sd"> offers is kept. The helper skips a later track whose ``Tracks.signature`` matches a held</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-290"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-290" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-290"></a><span class="sd"> helper from their get_tracks() implementation.</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-290"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-290" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-290"></a><span class="sd"> one, because its ID can differ between manifests. Chapters and attachments come from the</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-291"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-291" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-291"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-291"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-291" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-291"></a><span class="sd"> first combo only.</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-292"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-292" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-292"></a><span class="sd"> The fetch_fn signature should be: (title, codec, range_) -&gt; Tracks</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-292"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-292" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-292"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-293"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-293" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-293"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-293"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-293" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-293"></a><span class="sd"> Services that need separate API calls per codec/range combo can use this</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-294"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-294" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-294"></a><span class="sd"> For HYBRID range, this helper calls fetch_fn with HDR10 and DV separately,</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-294"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-294" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-294"></a><span class="sd"> helper from their get_tracks() implementation.</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-295"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-295" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-295"></a><span class="sd"> then merges the DV tracks into the HDR10 result. With no DV video and</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-295"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-295" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-295"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-296"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-296" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-296"></a><span class="sd"> ``generate_dv`` requested, it merges the HDR10P tracks instead.</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-296"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-296" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-296"></a><span class="sd"> The fetch_fn signature should be: (title, codec, range_) -&gt; Tracks</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-297"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-297" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-297"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-297"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-297" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-297"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-298"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-298" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-298"></a><span class="sd"> Args:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-298"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-298" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-298"></a><span class="sd"> For HYBRID range, this helper calls fetch_fn with HDR10 and DV separately,</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-299"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-299" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-299"></a><span class="sd"> title: The title to process.</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-299"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-299" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-299"></a><span class="sd"> then merges the DV tracks into the HDR10 result. With no DV video and</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-300"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-300" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-300"></a><span class="sd"> fetch_fn: A callable that fetches tracks for a specific codec/range.</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-300"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-300" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-300"></a><span class="sd"> ``generate_dv`` requested, it merges the HDR10P tracks instead.</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-301"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-301" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-301"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-301"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-301" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-301"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-302"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-302" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-302"></a> <span class="n">all_tracks</span> <span class="o">=</span> <span class="n">Tracks</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-302"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-302" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-302"></a><span class="sd"> Args:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-303"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-303" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-303"></a> <span class="n">first</span> <span class="o">=</span> <span class="kc">True</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-303"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-303" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-303"></a><span class="sd"> title: The title to process.</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-304"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-304" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-304"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-304"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-304" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-304"></a><span class="sd"> fetch_fn: A callable that fetches tracks for a specific codec/range.</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-305"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-305" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-305"></a> <span class="k">def</span><span class="w"> </span><span class="nf">merge</span><span class="p">(</span><span class="n">tracks</span><span class="p">:</span> <span class="n">Tracks</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-305"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-305" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-305"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-306"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-306" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-306"></a> <span class="k">nonlocal</span> <span class="n">first</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-306"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-306" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-306"></a> <span class="n">all_tracks</span> <span class="o">=</span> <span class="n">Tracks</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-307"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-307" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-307"></a> <span class="k">if</span> <span class="n">first</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-307"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-307" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-307"></a> <span class="n">first</span> <span class="o">=</span> <span class="kc">True</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-308"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-308" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-308"></a> <span class="n">all_tracks</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">tracks</span><span class="p">,</span> <span class="n">warn_only</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-308"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-308" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-308"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-309"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-309" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-309"></a> <span class="n">first</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-309"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-309" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-309"></a> <span class="k">def</span><span class="w"> </span><span class="nf">merge</span><span class="p">(</span><span class="n">tracks</span><span class="p">:</span> <span class="n">Tracks</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-310"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-310" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-310"></a> <span class="k">return</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-310"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-310" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-310"></a> <span class="k">nonlocal</span> <span class="n">first</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-311"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-311" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-311"></a> <span class="n">held</span> <span class="o">=</span> <span class="p">{</span><span class="n">Tracks</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">track</span><span class="p">)</span> <span class="k">for</span> <span class="n">track</span> <span class="ow">in</span> <span class="n">all_tracks</span><span class="p">}</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-311"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-311" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-311"></a> <span class="k">if</span> <span class="n">first</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-312"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-312" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-312"></a> <span class="n">all_tracks</span><span class="o">.</span><span class="n">add</span><span class="p">([</span><span class="n">track</span> <span class="k">for</span> <span class="n">track</span> <span class="ow">in</span> <span class="n">tracks</span> <span class="k">if</span> <span class="n">Tracks</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">track</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">held</span><span class="p">],</span> <span class="n">warn_only</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-312"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-312" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-312"></a> <span class="n">all_tracks</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">tracks</span><span class="p">,</span> <span class="n">warn_only</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-313"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-313" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-313"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-313"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-313" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-313"></a> <span class="n">first</span> <span class="o">=</span> <span class="kc">False</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-314"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-314" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-314"></a> <span class="n">codecs</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">Codec</span> <span class="o">|</span> <span class="kc">None</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">codecs</span> <span class="ow">or</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-314"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-314" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-314"></a> <span class="k">return</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-315"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-315" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-315"></a> <span class="n">ranges</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">ranges</span> <span class="ow">or</span> <span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">SDR</span><span class="p">]</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-315"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-315" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-315"></a> <span class="n">held</span> <span class="o">=</span> <span class="p">{</span><span class="n">Tracks</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">track</span><span class="p">)</span> <span class="k">for</span> <span class="n">track</span> <span class="ow">in</span> <span class="n">all_tracks</span><span class="p">}</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-316"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-316" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-316"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-316"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-316" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-316"></a> <span class="n">all_tracks</span><span class="o">.</span><span class="n">add</span><span class="p">([</span><span class="n">track</span> <span class="k">for</span> <span class="n">track</span> <span class="ow">in</span> <span class="n">tracks</span> <span class="k">if</span> <span class="n">Tracks</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">track</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">held</span><span class="p">],</span> <span class="n">warn_only</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-317"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-317" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-317"></a> <span class="k">for</span> <span class="n">range_val</span> <span class="ow">in</span> <span class="n">ranges</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-317"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-317" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-317"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-318"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-318" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-318"></a> <span class="k">if</span> <span class="n">range_val</span> <span class="o">==</span> <span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HYBRID</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-318"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-318" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-318"></a> <span class="n">codecs</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">Codec</span> <span class="o">|</span> <span class="kc">None</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">codecs</span> <span class="ow">or</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-319"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-319" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-319"></a> <span class="c1"># HYBRID: fetch HDR10 first, then DV</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-319"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-319" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-319"></a> <span class="n">ranges</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">ranges</span> <span class="ow">or</span> <span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">SDR</span><span class="p">]</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-320"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-320" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-320"></a> <span class="k">for</span> <span class="n">codec_val</span> <span class="ow">in</span> <span class="n">codecs</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-320"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-320" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-320"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-321"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-321" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-321"></a> <span class="k">try</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-321"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-321" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-321"></a> <span class="k">for</span> <span class="n">range_val</span> <span class="ow">in</span> <span class="n">ranges</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-322"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-322" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-322"></a> <span class="n">hdr_tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HDR10</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-322"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-322" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-322"></a> <span class="k">if</span> <span class="n">range_val</span> <span class="o">==</span> <span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HYBRID</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-323"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-323" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-323"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-323"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-323" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-323"></a> <span class="c1"># HYBRID: fetch HDR10 first, then DV</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-324"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-324" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-324"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">best_available</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-324"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-324" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-324"></a> <span class="k">for</span> <span class="n">codec_val</span> <span class="ow">in</span> <span class="n">codecs</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-325"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-325" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-325"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="sa">f</span><span class="s2">" - HDR10 not available for HYBRID, skipping (</span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-325"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-325" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-325"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-326"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-326" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-326"></a> <span class="k">continue</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-326"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-326" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-326"></a> <span class="n">hdr_tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HDR10</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-327"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-327" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-327"></a> <span class="k">raise</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-327"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-327" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-327"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-328"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-328" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-328"></a> <span class="n">merge</span><span class="p">(</span><span class="n">hdr_tracks</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-328"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-328" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-328"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">best_available</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-329"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-329" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-329"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-329"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-329" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-329"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="sa">f</span><span class="s2">" - HDR10 not available for HYBRID, skipping (</span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-330"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-330" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-330"></a> <span class="k">try</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-330"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-330" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-330"></a> <span class="k">continue</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-331"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-331" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-331"></a> <span class="n">dv_tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">DV</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-331"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-331" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-331"></a> <span class="k">raise</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-332"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-332" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-332"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">):</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-332"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-332" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-332"></a> <span class="n">merge</span><span class="p">(</span><span class="n">hdr_tracks</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-333"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-333" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-333"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">" - No DolbyVision manifest available for HYBRID"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-333"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-333" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-333"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-334"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-334" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-334"></a> <span class="n">dv_tracks</span> <span class="o">=</span> <span class="n">Tracks</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-334"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-334" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-334"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-335"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-335" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-335"></a> <span class="n">merge</span><span class="p">(</span><span class="n">dv_tracks</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-335"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-335" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-335"></a> <span class="n">dv_tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">DV</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-336"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-336" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-336"></a> <span class="n">has_hdr10p</span> <span class="o">=</span> <span class="nb">any</span><span class="p">(</span><span class="n">v</span><span class="o">.</span><span class="n">range</span> <span class="o">==</span> <span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HDR10P</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">all_tracks</span><span class="o">.</span><span class="n">videos</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-336"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-336" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-336"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">):</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-337"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-337" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-337"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">dv_tracks</span><span class="o">.</span><span class="n">videos</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">generate_dv</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">has_hdr10p</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-337"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-337" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-337"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">" - No DolbyVision manifest available for HYBRID"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-338"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-338" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-338"></a> <span class="c1"># the HDR10 request may not return HDR10+, which the conversion needs as its base</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-338"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-338" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-338"></a> <span class="n">dv_tracks</span> <span class="o">=</span> <span class="n">Tracks</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-339"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-339" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-339"></a> <span class="k">try</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-339"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-339" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-339"></a> <span class="n">merge</span><span class="p">(</span><span class="n">dv_tracks</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-340"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-340" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-340"></a> <span class="n">hdr10p_tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HDR10P</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-340"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-340" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-340"></a> <span class="n">has_hdr10p</span> <span class="o">=</span> <span class="nb">any</span><span class="p">(</span><span class="n">v</span><span class="o">.</span><span class="n">range</span> <span class="o">==</span> <span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HDR10P</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">all_tracks</span><span class="o">.</span><span class="n">videos</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-341"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-341" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-341"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">):</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-341"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-341" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-341"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">dv_tracks</span><span class="o">.</span><span class="n">videos</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">generate_dv</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">has_hdr10p</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-342"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-342" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-342"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">" - No HDR10+ manifest available for HYBRID"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-342"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-342" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-342"></a> <span class="c1"># the HDR10 request may not return HDR10+, which the conversion needs as its base</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-343"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-343" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-343"></a> <span class="k">else</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-343"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-343" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-343"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-344"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-344" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-344"></a> <span class="n">merge</span><span class="p">(</span><span class="n">hdr10p_tracks</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-344"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-344" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-344"></a> <span class="n">hdr10p_tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">Video</span><span class="o">.</span><span class="n">Range</span><span class="o">.</span><span class="n">HDR10P</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-345"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-345" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-345"></a> <span class="k">else</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-345"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-345" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-345"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">):</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-346"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-346" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-346"></a> <span class="k">for</span> <span class="n">codec_val</span> <span class="ow">in</span> <span class="n">codecs</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-346"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-346" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-346"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">" - No HDR10+ manifest available for HYBRID"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-347"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-347" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-347"></a> <span class="k">try</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-347"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-347" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-347"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-348"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-348" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-348"></a> <span class="n">tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">range_val</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-348"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-348" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-348"></a> <span class="n">merge</span><span class="p">(</span><span class="n">hdr10p_tracks</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-349"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-349" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-349"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-349"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-349" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-349"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-350"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-350" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-350"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">best_available</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-350"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-350" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-350"></a> <span class="k">for</span> <span class="n">codec_val</span> <span class="ow">in</span> <span class="n">codecs</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-351"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-351" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-351"></a> <span class="n">codec_name</span> <span class="o">=</span> <span class="n">codec_val</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">codec_val</span> <span class="k">else</span> <span class="s2">"default"</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-351"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-351" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-351"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-352"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-352" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-352"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="sa">f</span><span class="s2">" - </span><span class="si">{</span><span class="n">range_val</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">codec_name</span><span class="si">}</span><span class="s2"> not available, skipping (</span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-352"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-352" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-352"></a> <span class="n">tracks</span> <span class="o">=</span> <span class="n">fetch_fn</span><span class="p">(</span><span class="n">title</span><span class="p">,</span> <span class="n">codec</span><span class="o">=</span><span class="n">codec_val</span><span class="p">,</span> <span class="n">range_</span><span class="o">=</span><span class="n">range_val</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-353"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-353" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-353"></a> <span class="k">continue</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-353"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-353" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-353"></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SystemExit</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-354"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-354" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-354"></a> <span class="k">raise</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-354"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-354" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-354"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">track_request</span><span class="o">.</span><span class="n">best_available</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-355"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-355" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-355"></a> <span class="n">merge</span><span class="p">(</span><span class="n">tracks</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-355"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-355" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-355"></a> <span class="n">codec_name</span> <span class="o">=</span> <span class="n">codec_val</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">codec_val</span> <span class="k">else</span> <span class="s2">"default"</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-356"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-356" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-356"></a> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-356"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-356" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-356"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="sa">f</span><span class="s2">" - </span><span class="si">{</span><span class="n">range_val</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="n">codec_name</span><span class="si">}</span><span class="s2"> not available, skipping (</span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-357"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-357" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-357"></a> <span class="k">return</span> <span class="n">all_tracks</span> </span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-357"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-357" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-357"></a> <span class="k">continue</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-358"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-358" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-358"></a> <span class="k">raise</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-359"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-359" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-359"></a> <span class="n">merge</span><span class="p">(</span><span class="n">tracks</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-360"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-360" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-360"></a>
</span><span id="unshackle.core.service.Service.get_tracks_for_variants--source--__span-0-361"><a id="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-361" name="unshackle.core.service.Service.get_tracks_for_variants--source--__codelineno-0-361"></a> <span class="k">return</span> <span class="n">all_tracks</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -3670,11 +3678,7 @@ from config, cookies, retry handler, and a proxy if available.
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-359">359</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-363">363</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-360">360</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-361">361</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-362">362</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-363">363</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-364">364</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-364">364</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-365">365</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-365">365</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-366">366</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-366">366</a></span>
@@ -3703,40 +3707,44 @@ from config, cookies, retry handler, and a proxy if available.
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-389">389</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-389">389</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-390">390</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-390">390</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-391">391</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-391">391</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-392">392</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_session--source--__span-0-359"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-359" name="unshackle.core.service.Service.get_session--source--__codelineno-0-359"></a><span class="nd">@staticmethod</span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-392">392</a></span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-360"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-360" name="unshackle.core.service.Service.get_session--source--__codelineno-0-360"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_session</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">requests</span><span class="o">.</span><span class="n">Session</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-393">393</a></span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-361"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-361" name="unshackle.core.service.Service.get_session--source--__codelineno-0-361"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-394">394</a></span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-362"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-362" name="unshackle.core.service.Service.get_session--source--__codelineno-0-362"></a><span class="sd"> Creates a Python-requests HTTP session, adds common headers</span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-395">395</a></span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-363"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-363" name="unshackle.core.service.Service.get_session--source--__codelineno-0-363"></a><span class="sd"> from config, cookies, retry handler, and a proxy if available.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_session--source--__codelineno-0-396">396</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_session--source--__span-0-363"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-363" name="unshackle.core.service.Service.get_session--source--__codelineno-0-363"></a><span class="nd">@staticmethod</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-364"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-364" name="unshackle.core.service.Service.get_session--source--__codelineno-0-364"></a><span class="sd"> :returns: Prepared Python-requests HTTP session</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-364"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-364" name="unshackle.core.service.Service.get_session--source--__codelineno-0-364"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_session</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">requests</span><span class="o">.</span><span class="n">Session</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-365"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-365" name="unshackle.core.service.Service.get_session--source--__codelineno-0-365"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-365"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-365" name="unshackle.core.service.Service.get_session--source--__codelineno-0-365"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-366"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-366" name="unshackle.core.service.Service.get_session--source--__codelineno-0-366"></a> <span class="n">session</span> <span class="o">=</span> <span class="n">TimeoutSession</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-366"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-366" name="unshackle.core.service.Service.get_session--source--__codelineno-0-366"></a><span class="sd"> Creates a Python-requests HTTP session, adds common headers</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-367"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-367" name="unshackle.core.service.Service.get_session--source--__codelineno-0-367"></a> <span class="n">session</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">config</span><span class="o">.</span><span class="n">headers</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-367"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-367" name="unshackle.core.service.Service.get_session--source--__codelineno-0-367"></a><span class="sd"> from config, cookies, retry handler, and a proxy if available.</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-368"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-368" name="unshackle.core.service.Service.get_session--source--__codelineno-0-368"></a> <span class="c1"># Retry / pool policy mirrors RnetSession via the shared constants in session.py:</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-368"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-368" name="unshackle.core.service.Service.get_session--source--__codelineno-0-368"></a><span class="sd"> :returns: Prepared Python-requests HTTP session</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-369"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-369" name="unshackle.core.service.Service.get_session--source--__codelineno-0-369"></a> <span class="c1"># same total, forcelist, backoff cap, allowed_methods (incl. POST, so license</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-369"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-369" name="unshackle.core.service.Service.get_session--source--__codelineno-0-369"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-370"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-370" name="unshackle.core.service.Service.get_session--source--__codelineno-0-370"></a> <span class="c1"># requests retry on both paths), and pool size. Accepted divergence: urllib3's</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-370"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-370" name="unshackle.core.service.Service.get_session--source--__codelineno-0-370"></a> <span class="n">session</span> <span class="o">=</span> <span class="n">TimeoutSession</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-371"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-371" name="unshackle.core.service.Service.get_session--source--__codelineno-0-371"></a> <span class="c1"># backoff_jitter adds an absolute 0..N seconds whereas rnet jitters ±10% of the</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-371"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-371" name="unshackle.core.service.Service.get_session--source--__codelineno-0-371"></a> <span class="n">session</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">config</span><span class="o">.</span><span class="n">headers</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-372"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-372" name="unshackle.core.service.Service.get_session--source--__codelineno-0-372"></a> <span class="c1"># backoff, the only intentional difference, not worth hand-rolling a retry loop.</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-372"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-372" name="unshackle.core.service.Service.get_session--source--__codelineno-0-372"></a> <span class="c1"># Retry / pool policy mirrors RnetSession via the shared constants in session.py:</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-373"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-373" name="unshackle.core.service.Service.get_session--source--__codelineno-0-373"></a> <span class="n">session</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-373"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-373" name="unshackle.core.service.Service.get_session--source--__codelineno-0-373"></a> <span class="c1"># same total, forcelist, backoff cap, allowed_methods (incl. POST, so license</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-374"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-374" name="unshackle.core.service.Service.get_session--source--__codelineno-0-374"></a> <span class="s2">"https://"</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-374"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-374" name="unshackle.core.service.Service.get_session--source--__codelineno-0-374"></a> <span class="c1"># requests retry on both paths), and pool size. Accepted divergence: urllib3's</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-375"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-375" name="unshackle.core.service.Service.get_session--source--__codelineno-0-375"></a> <span class="n">TimeoutHTTPAdapter</span><span class="p">(</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-375"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-375" name="unshackle.core.service.Service.get_session--source--__codelineno-0-375"></a> <span class="c1"># backoff_jitter adds an absolute 0..N seconds whereas rnet jitters ±10% of the</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-376"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-376" name="unshackle.core.service.Service.get_session--source--__codelineno-0-376"></a> <span class="n">max_retries</span><span class="o">=</span><span class="n">Retry</span><span class="p">(</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-376"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-376" name="unshackle.core.service.Service.get_session--source--__codelineno-0-376"></a> <span class="c1"># backoff, the only intentional difference, not worth hand-rolling a retry loop.</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-377"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-377" name="unshackle.core.service.Service.get_session--source--__codelineno-0-377"></a> <span class="n">total</span><span class="o">=</span><span class="n">MAX_RETRIES</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-377"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-377" name="unshackle.core.service.Service.get_session--source--__codelineno-0-377"></a> <span class="n">session</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-378"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-378" name="unshackle.core.service.Service.get_session--source--__codelineno-0-378"></a> <span class="n">backoff_factor</span><span class="o">=</span><span class="n">BACKOFF_FACTOR</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-378"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-378" name="unshackle.core.service.Service.get_session--source--__codelineno-0-378"></a> <span class="s2">"https://"</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-379"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-379" name="unshackle.core.service.Service.get_session--source--__codelineno-0-379"></a> <span class="n">backoff_max</span><span class="o">=</span><span class="n">MAX_BACKOFF</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-379"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-379" name="unshackle.core.service.Service.get_session--source--__codelineno-0-379"></a> <span class="n">TimeoutHTTPAdapter</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-380"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-380" name="unshackle.core.service.Service.get_session--source--__codelineno-0-380"></a> <span class="n">backoff_jitter</span><span class="o">=</span><span class="mf">0.2</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-380"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-380" name="unshackle.core.service.Service.get_session--source--__codelineno-0-380"></a> <span class="n">max_retries</span><span class="o">=</span><span class="n">Retry</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-381"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-381" name="unshackle.core.service.Service.get_session--source--__codelineno-0-381"></a> <span class="n">status_forcelist</span><span class="o">=</span><span class="n">STATUS_FORCELIST</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-381"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-381" name="unshackle.core.service.Service.get_session--source--__codelineno-0-381"></a> <span class="n">total</span><span class="o">=</span><span class="n">MAX_RETRIES</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-382"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-382" name="unshackle.core.service.Service.get_session--source--__codelineno-0-382"></a> <span class="n">allowed_methods</span><span class="o">=</span><span class="n">RETRY_METHODS</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-382"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-382" name="unshackle.core.service.Service.get_session--source--__codelineno-0-382"></a> <span class="n">backoff_factor</span><span class="o">=</span><span class="n">BACKOFF_FACTOR</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-383"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-383" name="unshackle.core.service.Service.get_session--source--__codelineno-0-383"></a> <span class="n">respect_retry_after_header</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-383"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-383" name="unshackle.core.service.Service.get_session--source--__codelineno-0-383"></a> <span class="n">backoff_max</span><span class="o">=</span><span class="n">MAX_BACKOFF</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-384"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-384" name="unshackle.core.service.Service.get_session--source--__codelineno-0-384"></a> <span class="n">retry_after_max</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">MAX_BACKOFF</span><span class="p">),</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-384"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-384" name="unshackle.core.service.Service.get_session--source--__codelineno-0-384"></a> <span class="n">backoff_jitter</span><span class="o">=</span><span class="mf">0.2</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-385"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-385" name="unshackle.core.service.Service.get_session--source--__codelineno-0-385"></a> <span class="p">),</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-385"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-385" name="unshackle.core.service.Service.get_session--source--__codelineno-0-385"></a> <span class="n">status_forcelist</span><span class="o">=</span><span class="n">STATUS_FORCELIST</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-386"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-386" name="unshackle.core.service.Service.get_session--source--__codelineno-0-386"></a> <span class="n">pool_connections</span><span class="o">=</span><span class="n">POOL_MAX_SIZE</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-386"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-386" name="unshackle.core.service.Service.get_session--source--__codelineno-0-386"></a> <span class="n">allowed_methods</span><span class="o">=</span><span class="n">RETRY_METHODS</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-387"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-387" name="unshackle.core.service.Service.get_session--source--__codelineno-0-387"></a> <span class="n">pool_maxsize</span><span class="o">=</span><span class="n">POOL_MAX_SIZE</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-387"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-387" name="unshackle.core.service.Service.get_session--source--__codelineno-0-387"></a> <span class="n">respect_retry_after_header</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-388"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-388" name="unshackle.core.service.Service.get_session--source--__codelineno-0-388"></a> <span class="n">pool_block</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-388"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-388" name="unshackle.core.service.Service.get_session--source--__codelineno-0-388"></a> <span class="n">retry_after_max</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">MAX_BACKOFF</span><span class="p">),</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-389"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-389" name="unshackle.core.service.Service.get_session--source--__codelineno-0-389"></a> <span class="p">),</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-389"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-389" name="unshackle.core.service.Service.get_session--source--__codelineno-0-389"></a> <span class="p">),</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-390"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-390" name="unshackle.core.service.Service.get_session--source--__codelineno-0-390"></a> <span class="p">)</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-390"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-390" name="unshackle.core.service.Service.get_session--source--__codelineno-0-390"></a> <span class="n">pool_connections</span><span class="o">=</span><span class="n">POOL_MAX_SIZE</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-391"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-391" name="unshackle.core.service.Service.get_session--source--__codelineno-0-391"></a> <span class="n">session</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="s2">"http://"</span><span class="p">,</span> <span class="n">session</span><span class="o">.</span><span class="n">adapters</span><span class="p">[</span><span class="s2">"https://"</span><span class="p">])</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-391"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-391" name="unshackle.core.service.Service.get_session--source--__codelineno-0-391"></a> <span class="n">pool_maxsize</span><span class="o">=</span><span class="n">POOL_MAX_SIZE</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-392"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-392" name="unshackle.core.service.Service.get_session--source--__codelineno-0-392"></a> <span class="k">return</span> <span class="n">session</span> </span><span id="unshackle.core.service.Service.get_session--source--__span-0-392"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-392" name="unshackle.core.service.Service.get_session--source--__codelineno-0-392"></a> <span class="n">pool_block</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-393"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-393" name="unshackle.core.service.Service.get_session--source--__codelineno-0-393"></a> <span class="p">),</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-394"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-394" name="unshackle.core.service.Service.get_session--source--__codelineno-0-394"></a> <span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-395"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-395" name="unshackle.core.service.Service.get_session--source--__codelineno-0-395"></a> <span class="n">session</span><span class="o">.</span><span class="n">mount</span><span class="p">(</span><span class="s2">"http://"</span><span class="p">,</span> <span class="n">session</span><span class="o">.</span><span class="n">adapters</span><span class="p">[</span><span class="s2">"https://"</span><span class="p">])</span>
</span><span id="unshackle.core.service.Service.get_session--source--__span-0-396"><a id="unshackle.core.service.Service.get_session--source--__codelineno-0-396" name="unshackle.core.service.Service.get_session--source--__codelineno-0-396"></a> <span class="k">return</span> <span class="n">session</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -3766,19 +3774,19 @@ from config, cookies, retry handler, and a proxy if available.
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-394">394</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-398">398</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-395">395</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-396">396</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-397">397</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-398">398</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-399">399</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-399">399</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-400">400</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_binaries--source--__span-0-394"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-394" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-394"></a><span class="nd">@staticmethod</span> <span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-400">400</a></span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-395"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-395" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-395"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_binaries</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="nb">dict</span><span class="p">]:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-401">401</a></span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-396"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-396" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-396"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-402">402</a></span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-397"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-397" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-397"></a><span class="sd"> Declare custom binary dependencies required by this service.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-403">403</a></span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-398"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-398" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-398"></a><span class="sd"> :returns: List of dicts, each with a ``name`` and optional ``candidates`` and ``desc``.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_binaries--source--__codelineno-0-404">404</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_binaries--source--__span-0-398"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-398" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-398"></a><span class="nd">@staticmethod</span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-399"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-399" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-399"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-399"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-399" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-399"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_binaries</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="nb">dict</span><span class="p">]:</span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-400"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-400" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-400"></a> <span class="k">return</span> <span class="p">[]</span> </span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-400"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-400" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-400"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-401"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-401" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-401"></a><span class="sd"> Declare custom binary dependencies required by this service.</span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-402"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-402" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-402"></a><span class="sd"> :returns: List of dicts, each with a ``name`` and optional ``candidates`` and ``desc``.</span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-403"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-403" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-403"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.get_binaries--source--__span-0-404"><a id="unshackle.core.service.Service.get_binaries--source--__codelineno-0-404" name="unshackle.core.service.Service.get_binaries--source--__codelineno-0-404"></a> <span class="k">return</span> <span class="p">[]</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -3811,11 +3819,7 @@ the cookies into the service HTTP session.</p>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-402">402</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-406">406</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-403">403</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-404">404</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-405">405</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-406">406</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-407">407</a></span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-407">407</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-408">408</a></span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-408">408</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-409">409</a></span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-409">409</a></span>
@@ -3832,28 +3836,32 @@ the cookies into the service HTTP session.</p>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-420">420</a></span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-420">420</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-421">421</a></span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-421">421</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-422">422</a></span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-422">422</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-423">423</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.authenticate--source--__span-0-402"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-402" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-402"></a><span class="k">def</span><span class="w"> </span><span class="nf">authenticate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cookies</span><span class="p">:</span> <span class="n">CookieJar</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">credential</span><span class="p">:</span> <span class="n">Credential</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-423">423</a></span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-403"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-403" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-403"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-424">424</a></span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-404"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-404" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-404"></a><span class="sd"> Authenticate the Service with Cookies and/or Credentials (Email/Username and Password).</span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-425">425</a></span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-405"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-405" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-405"></a> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-426">426</a></span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-406"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-406" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-406"></a><span class="sd"> This is effectively a login() function. Any API calls or object initializations</span> <span class="normal"><a href="#unshackle.core.service.Service.authenticate--source--__codelineno-0-427">427</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.authenticate--source--__span-0-406"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-406" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-406"></a><span class="k">def</span><span class="w"> </span><span class="nf">authenticate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cookies</span><span class="p">:</span> <span class="n">CookieJar</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">credential</span><span class="p">:</span> <span class="n">Credential</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-407"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-407" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-407"></a><span class="sd"> needing to be made, should be made here. unshackle operates this method before</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-407"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-407" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-407"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-408"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-408" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-408"></a><span class="sd"> any of the following abstract functions. The one exception is a search on a</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-408"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-408" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-408"></a><span class="sd"> Authenticate the Service with Cookies and/or Credentials (Email/Username and Password).</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-409"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-409" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-409"></a><span class="sd"> Service that sets ``ANONYMOUS_SEARCH``, which does not operate this method.</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-409"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-409" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-409"></a>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-410"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-410" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-410"></a> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-410"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-410" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-410"></a><span class="sd"> This is effectively a login() function. Any API calls or object initializations</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-411"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-411" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-411"></a><span class="sd"> You should avoid storing or using the Credential outside this function.</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-411"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-411" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-411"></a><span class="sd"> needing to be made, should be made here. unshackle operates this method before</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-412"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-412" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-412"></a><span class="sd"> Make any calls you need for any Cookies, Tokens, or such, then use those.</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-412"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-412" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-412"></a><span class="sd"> any of the following abstract functions. The one exception is a search on a</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-413"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-413" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-413"></a> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-413"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-413" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-413"></a><span class="sd"> Service that sets ``ANONYMOUS_SEARCH``, which does not operate this method.</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-414"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-414" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-414"></a><span class="sd"> Do not store the cookies outside this function either. However, you can load</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-414"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-414" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-414"></a>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-415"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-415" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-415"></a><span class="sd"> the cookies into the service HTTP session.</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-415"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-415" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-415"></a><span class="sd"> You should avoid storing or using the Credential outside this function.</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-416"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-416" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-416"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-416"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-416" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-416"></a><span class="sd"> Make any calls you need for any Cookies, Tokens, or such, then use those.</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-417"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-417" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-417"></a> <span class="k">if</span> <span class="n">cookies</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-417"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-417" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-417"></a>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-418"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-418" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-418"></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cookies</span><span class="p">,</span> <span class="n">CookieJar</span><span class="p">):</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-418"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-418" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-418"></a><span class="sd"> Do not store the cookies outside this function either. However, you can load</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-419"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-419" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-419"></a> <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected cookies to be a </span><span class="si">{</span><span class="n">CookieJar</span><span class="si">}</span><span class="s2">, not </span><span class="si">{</span><span class="n">cookies</span><span class="si">!r}</span><span class="s2">."</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-419"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-419" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-419"></a><span class="sd"> the cookies into the service HTTP session.</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-420"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-420" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-420"></a> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">cookies</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">cookies</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-420"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-420" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-420"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-421"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-421" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-421"></a> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-421"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-421" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-421"></a> <span class="k">if</span> <span class="n">cookies</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-422"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-422" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-422"></a> <span class="c1"># Store credential for cache key generation</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-422"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-422" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-422"></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cookies</span><span class="p">,</span> <span class="n">CookieJar</span><span class="p">):</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-423"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-423" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-423"></a> <span class="bp">self</span><span class="o">.</span><span class="n">credential</span> <span class="o">=</span> <span class="n">credential</span> </span><span id="unshackle.core.service.Service.authenticate--source--__span-0-423"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-423" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-423"></a> <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected cookies to be a </span><span class="si">{</span><span class="n">CookieJar</span><span class="si">}</span><span class="s2">, not </span><span class="si">{</span><span class="n">cookies</span><span class="si">!r}</span><span class="s2">."</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-424"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-424" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-424"></a> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">cookies</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">cookies</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-425"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-425" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-425"></a>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-426"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-426" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-426"></a> <span class="c1"># Store credential for cache key generation</span>
</span><span id="unshackle.core.service.Service.authenticate--source--__span-0-427"><a id="unshackle.core.service.Service.authenticate--source--__codelineno-0-427" name="unshackle.core.service.Service.authenticate--source--__codelineno-0-427"></a> <span class="bp">self</span><span class="o">.</span><span class="n">credential</span> <span class="o">=</span> <span class="n">credential</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -3882,27 +3890,27 @@ REST download job relays it through <code>prompt_user</code> to the job's <code>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-425">425</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-429">429</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-426">426</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-427">427</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-428">428</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-429">429</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-430">430</a></span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-430">430</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-431">431</a></span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-431">431</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-432">432</a></span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-432">432</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-433">433</a></span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-433">433</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-434">434</a></span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-434">434</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-435">435</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.request_input--source--__span-0-425"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-425" name="unshackle.core.service.Service.request_input--source--__codelineno-0-425"></a><span class="k">def</span><span class="w"> </span><span class="nf">request_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prompt</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">qr</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-435">435</a></span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-426"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-426" name="unshackle.core.service.Service.request_input--source--__codelineno-0-426"></a><span class="w"> </span><span class="sd">"""Request interactive input from the user.</span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-436">436</a></span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-427"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-427" name="unshackle.core.service.Service.request_input--source--__codelineno-0-427"></a> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-437">437</a></span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-428"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-428" name="unshackle.core.service.Service.request_input--source--__codelineno-0-428"></a><span class="sd"> Locally, prompts through the shared rich console so the prompt renders alongside</span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-438">438</a></span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-429"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-429" name="unshackle.core.service.Service.request_input--source--__codelineno-0-429"></a><span class="sd"> Live progress. A remote-dl session relays it through its :class:`InputBridge`, and a</span> <span class="normal"><a href="#unshackle.core.service.Service.request_input--source--__codelineno-0-439">439</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.request_input--source--__span-0-429"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-429" name="unshackle.core.service.Service.request_input--source--__codelineno-0-429"></a><span class="k">def</span><span class="w"> </span><span class="nf">request_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prompt</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">qr</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-430"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-430" name="unshackle.core.service.Service.request_input--source--__codelineno-0-430"></a><span class="sd"> REST download job relays it through ``prompt_user`` to the job's ``input_prompt``.</span> </span><span id="unshackle.core.service.Service.request_input--source--__span-0-430"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-430" name="unshackle.core.service.Service.request_input--source--__codelineno-0-430"></a><span class="w"> </span><span class="sd">"""Request interactive input from the user.</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-431"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-431" name="unshackle.core.service.Service.request_input--source--__codelineno-0-431"></a><span class="sd"> *qr* is the text of a QR code for the user to scan; the terminal that asks the user draws it.</span> </span><span id="unshackle.core.service.Service.request_input--source--__span-0-431"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-431" name="unshackle.core.service.Service.request_input--source--__codelineno-0-431"></a>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-432"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-432" name="unshackle.core.service.Service.request_input--source--__codelineno-0-432"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.request_input--source--__span-0-432"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-432" name="unshackle.core.service.Service.request_input--source--__codelineno-0-432"></a><span class="sd"> Locally, prompts through the shared rich console so the prompt renders alongside</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-433"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-433" name="unshackle.core.service.Service.request_input--source--__codelineno-0-433"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.request_input--source--__span-0-433"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-433" name="unshackle.core.service.Service.request_input--source--__codelineno-0-433"></a><span class="sd"> Live progress. A remote-dl session relays it through its :class:`InputBridge`, and a</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-434"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-434" name="unshackle.core.service.Service.request_input--source--__codelineno-0-434"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span><span class="o">.</span><span class="n">request_input</span><span class="p">(</span><span class="n">prompt</span><span class="p">,</span> <span class="n">qr</span><span class="o">=</span><span class="n">qr</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.request_input--source--__span-0-434"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-434" name="unshackle.core.service.Service.request_input--source--__codelineno-0-434"></a><span class="sd"> REST download job relays it through ``prompt_user`` to the job's ``input_prompt``.</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-435"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-435" name="unshackle.core.service.Service.request_input--source--__codelineno-0-435"></a> <span class="k">return</span> <span class="n">prompt_user</span><span class="p">(</span><span class="n">prompt</span><span class="p">,</span> <span class="n">qr</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.request_input--source--__span-0-435"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-435" name="unshackle.core.service.Service.request_input--source--__codelineno-0-435"></a><span class="sd"> *qr* is the text of a QR code for the user to scan; the terminal that asks the user draws it.</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-436"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-436" name="unshackle.core.service.Service.request_input--source--__codelineno-0-436"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-437"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-437" name="unshackle.core.service.Service.request_input--source--__codelineno-0-437"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-438"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-438" name="unshackle.core.service.Service.request_input--source--__codelineno-0-438"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span><span class="o">.</span><span class="n">request_input</span><span class="p">(</span><span class="n">prompt</span><span class="p">,</span> <span class="n">qr</span><span class="o">=</span><span class="n">qr</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.request_input--source--__span-0-439"><a id="unshackle.core.service.Service.request_input--source--__codelineno-0-439" name="unshackle.core.service.Service.request_input--source--__codelineno-0-439"></a> <span class="k">return</span> <span class="n">prompt_user</span><span class="p">(</span><span class="n">prompt</span><span class="p">,</span> <span class="n">qr</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -3934,11 +3942,7 @@ remote session no longer exists. A REST download job shows <code>message</code>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-437">437</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-441">441</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-438">438</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-439">439</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-440">440</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-441">441</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-442">442</a></span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-442">442</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-443">443</a></span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-443">443</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-444">444</a></span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-444">444</a></span>
@@ -3961,34 +3965,38 @@ remote session no longer exists. A REST download job shows <code>message</code>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-461">461</a></span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-461">461</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-462">462</a></span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-462">462</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-463">463</a></span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-463">463</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-464">464</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-437"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-437" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-437"></a><span class="k">def</span><span class="w"> </span><span class="nf">wait_for_approval</span><span class="p">(</span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-464">464</a></span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-438"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-438" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-438"></a> <span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">check</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[],</span> <span class="n">T</span> <span class="o">|</span> <span class="kc">None</span><span class="p">],</span> <span class="n">timeout</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">interval</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">3.0</span><span class="p">,</span> <span class="n">qr</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-465">465</a></span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-439"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-439" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-439"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">T</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-466">466</a></span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-440"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-440" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-440"></a><span class="w"> </span><span class="sd">"""Show ``message``, then call ``check`` until it returns a value.</span> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-467">467</a></span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-441"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-441" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-441"></a> <span class="normal"><a href="#unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-468">468</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-441"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-441" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-441"></a><span class="k">def</span><span class="w"> </span><span class="nf">wait_for_approval</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-442"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-442" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-442"></a><span class="sd"> Use it for a login that the user approves on another device, such as a pair code.</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-442"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-442" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-442"></a> <span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">check</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[],</span> <span class="n">T</span> <span class="o">|</span> <span class="kc">None</span><span class="p">],</span> <span class="n">timeout</span><span class="p">:</span> <span class="nb">float</span><span class="p">,</span> <span class="n">interval</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">3.0</span><span class="p">,</span> <span class="n">qr</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-443"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-443" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-443"></a><span class="sd"> ``check`` returns None while the approval is pending, and must return within a few</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-443"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-443" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-443"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">T</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-444"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-444" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-444"></a><span class="sd"> seconds. Raises TimeoutError after ``timeout`` seconds, and RuntimeError when the</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-444"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-444" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-444"></a><span class="w"> </span><span class="sd">"""Show ``message``, then call ``check`` until it returns a value.</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-445"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-445" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-445"></a><span class="sd"> remote session no longer exists. A REST download job shows ``message`` as its ``notice``.</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-445"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-445" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-445"></a>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-446"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-446" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-446"></a><span class="sd"> *qr* is the text of a QR code for the user to scan; a remote client gets it with the log record of ``message``.</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-446"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-446" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-446"></a><span class="sd"> Use it for a login that the user approves on another device, such as a pair code.</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-447"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-447" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-447"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-447"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-447" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-447"></a><span class="sd"> ``check`` returns None while the approval is pending, and must return within a few</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-448"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-448" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-448"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">extra</span><span class="o">=</span><span class="p">{</span><span class="s2">"qr"</span><span class="p">:</span> <span class="n">qr</span><span class="p">})</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-448"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-448" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-448"></a><span class="sd"> seconds. Raises TimeoutError after ``timeout`` seconds, and RuntimeError when the</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-449"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-449" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-449"></a> <span class="k">if</span> <span class="n">qr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-449"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-449" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-449"></a><span class="sd"> remote session no longer exists. A REST download job shows ``message`` as its ``notice``.</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-450"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-450" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-450"></a> <span class="n">show_qr</span><span class="p">(</span><span class="n">qr</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-450"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-450" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-450"></a><span class="sd"> *qr* is the text of a QR code for the user to scan; a remote client gets it with the log record of ``message``.</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-451"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-451" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-451"></a> <span class="n">show_notice</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">qr</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-451"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-451" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-451"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-452"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-452" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-452"></a> <span class="n">deadline</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">monotonic</span><span class="p">()</span> <span class="o">+</span> <span class="n">timeout</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-452"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-452" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-452"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">extra</span><span class="o">=</span><span class="p">{</span><span class="s2">"qr"</span><span class="p">:</span> <span class="n">qr</span><span class="p">})</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-453"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-453" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-453"></a> <span class="k">try</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-453"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-453" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-453"></a> <span class="k">if</span> <span class="n">qr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-454"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-454" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-454"></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-454"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-454" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-454"></a> <span class="n">show_qr</span><span class="p">(</span><span class="n">qr</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-455"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-455" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-455"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-455"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-455" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-455"></a> <span class="n">show_notice</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">qr</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-456"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-456" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-456"></a> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span><span class="o">.</span><span class="n">ensure_active</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-456"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-456" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-456"></a> <span class="n">deadline</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">monotonic</span><span class="p">()</span> <span class="o">+</span> <span class="n">timeout</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-457"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-457" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-457"></a> <span class="n">result</span> <span class="o">=</span> <span class="n">check</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-457"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-457" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-457"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-458"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-458" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-458"></a> <span class="k">if</span> <span class="n">result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-458"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-458" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-458"></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-459"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-459" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-459"></a> <span class="k">return</span> <span class="n">result</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-459"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-459" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-459"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-460"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-460" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-460"></a> <span class="k">if</span> <span class="n">time</span><span class="o">.</span><span class="n">monotonic</span><span class="p">()</span> <span class="o">+</span> <span class="n">interval</span> <span class="o">&gt;=</span> <span class="n">deadline</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-460"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-460" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-460"></a> <span class="bp">self</span><span class="o">.</span><span class="n">_input_bridge</span><span class="o">.</span><span class="n">ensure_active</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-461"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-461" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-461"></a> <span class="k">raise</span> <span class="n">coded</span><span class="p">(</span><span class="ne">TimeoutError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No approval within </span><span class="si">{</span><span class="n">timeout</span><span class="si">:</span><span class="s2">.0f</span><span class="si">}</span><span class="s2">s"</span><span class="p">),</span> <span class="n">APIErrorCode</span><span class="o">.</span><span class="n">AUTH_FAILED</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-461"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-461" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-461"></a> <span class="n">result</span> <span class="o">=</span> <span class="n">check</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-462"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-462" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-462"></a> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="n">interval</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-462"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-462" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-462"></a> <span class="k">if</span> <span class="n">result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-463"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-463" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-463"></a> <span class="k">finally</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-463"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-463" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-463"></a> <span class="k">return</span> <span class="n">result</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-464"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-464" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-464"></a> <span class="n">show_notice</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-464"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-464" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-464"></a> <span class="k">if</span> <span class="n">time</span><span class="o">.</span><span class="n">monotonic</span><span class="p">()</span> <span class="o">+</span> <span class="n">interval</span> <span class="o">&gt;=</span> <span class="n">deadline</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-465"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-465" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-465"></a> <span class="k">raise</span> <span class="n">coded</span><span class="p">(</span><span class="ne">TimeoutError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No approval within </span><span class="si">{</span><span class="n">timeout</span><span class="si">:</span><span class="s2">.0f</span><span class="si">}</span><span class="s2">s"</span><span class="p">),</span> <span class="n">APIErrorCode</span><span class="o">.</span><span class="n">AUTH_FAILED</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-466"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-466" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-466"></a> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="n">interval</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-467"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-467" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-467"></a> <span class="k">finally</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.wait_for_approval--source--__span-0-468"><a id="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-468" name="unshackle.core.service.Service.wait_for_approval--source--__codelineno-0-468"></a> <span class="n">show_notice</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -4016,25 +4024,25 @@ Ideally re-use the title ID argument (that is, self.title).</p>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-466">466</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-470">470</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-467">467</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-468">468</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-469">469</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-470">470</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-471">471</a></span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-471">471</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-472">472</a></span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-472">472</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-473">473</a></span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-473">473</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-474">474</a></span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-474">474</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-475">475</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.search--source--__span-0-466"><a id="unshackle.core.service.Service.search--source--__codelineno-0-466" name="unshackle.core.service.Service.search--source--__codelineno-0-466"></a><span class="k">def</span><span class="w"> </span><span class="nf">search</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Generator</span><span class="p">[</span><span class="n">SearchResult</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">]:</span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-475">475</a></span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-467"><a id="unshackle.core.service.Service.search--source--__codelineno-0-467" name="unshackle.core.service.Service.search--source--__codelineno-0-467"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-476">476</a></span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-468"><a id="unshackle.core.service.Service.search--source--__codelineno-0-468" name="unshackle.core.service.Service.search--source--__codelineno-0-468"></a><span class="sd"> Find titles from the Service by query.</span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-477">477</a></span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-469"><a id="unshackle.core.service.Service.search--source--__codelineno-0-469" name="unshackle.core.service.Service.search--source--__codelineno-0-469"></a> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-478">478</a></span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-470"><a id="unshackle.core.service.Service.search--source--__codelineno-0-470" name="unshackle.core.service.Service.search--source--__codelineno-0-470"></a><span class="sd"> The Service class must take the query as a CLI argument.</span> <span class="normal"><a href="#unshackle.core.service.Service.search--source--__codelineno-0-479">479</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.search--source--__span-0-470"><a id="unshackle.core.service.Service.search--source--__codelineno-0-470" name="unshackle.core.service.Service.search--source--__codelineno-0-470"></a><span class="k">def</span><span class="w"> </span><span class="nf">search</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Generator</span><span class="p">[</span><span class="n">SearchResult</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">]:</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-471"><a id="unshackle.core.service.Service.search--source--__codelineno-0-471" name="unshackle.core.service.Service.search--source--__codelineno-0-471"></a><span class="sd"> Ideally re-use the title ID argument (that is, self.title).</span> </span><span id="unshackle.core.service.Service.search--source--__span-0-471"><a id="unshackle.core.service.Service.search--source--__codelineno-0-471" name="unshackle.core.service.Service.search--source--__codelineno-0-471"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-472"><a id="unshackle.core.service.Service.search--source--__codelineno-0-472" name="unshackle.core.service.Service.search--source--__codelineno-0-472"></a> </span><span id="unshackle.core.service.Service.search--source--__span-0-472"><a id="unshackle.core.service.Service.search--source--__codelineno-0-472" name="unshackle.core.service.Service.search--source--__codelineno-0-472"></a><span class="sd"> Find titles from the Service by query.</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-473"><a id="unshackle.core.service.Service.search--source--__codelineno-0-473" name="unshackle.core.service.Service.search--source--__codelineno-0-473"></a><span class="sd"> unshackle displays the search results in the order yielded.</span> </span><span id="unshackle.core.service.Service.search--source--__span-0-473"><a id="unshackle.core.service.Service.search--source--__codelineno-0-473" name="unshackle.core.service.Service.search--source--__codelineno-0-473"></a>
</span><span id="unshackle.core.service.Service.search--source--__span-0-474"><a id="unshackle.core.service.Service.search--source--__codelineno-0-474" name="unshackle.core.service.Service.search--source--__codelineno-0-474"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.search--source--__span-0-474"><a id="unshackle.core.service.Service.search--source--__codelineno-0-474" name="unshackle.core.service.Service.search--source--__codelineno-0-474"></a><span class="sd"> The Service class must take the query as a CLI argument.</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-475"><a id="unshackle.core.service.Service.search--source--__codelineno-0-475" name="unshackle.core.service.Service.search--source--__codelineno-0-475"></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Search functionality has not been implemented by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.search--source--__span-0-475"><a id="unshackle.core.service.Service.search--source--__codelineno-0-475" name="unshackle.core.service.Service.search--source--__codelineno-0-475"></a><span class="sd"> Ideally re-use the title ID argument (that is, self.title).</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-476"><a id="unshackle.core.service.Service.search--source--__codelineno-0-476" name="unshackle.core.service.Service.search--source--__codelineno-0-476"></a>
</span><span id="unshackle.core.service.Service.search--source--__span-0-477"><a id="unshackle.core.service.Service.search--source--__codelineno-0-477" name="unshackle.core.service.Service.search--source--__codelineno-0-477"></a><span class="sd"> unshackle displays the search results in the order yielded.</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-478"><a id="unshackle.core.service.Service.search--source--__codelineno-0-478" name="unshackle.core.service.Service.search--source--__codelineno-0-478"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.search--source--__span-0-479"><a id="unshackle.core.service.Service.search--source--__codelineno-0-479" name="unshackle.core.service.Service.search--source--__codelineno-0-479"></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Search functionality has not been implemented by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -4069,11 +4077,7 @@ This can be useful to store information on each title that you need later, like
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-477">477</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-481">481</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-478">478</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-479">479</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-480">480</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-481">481</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-482">482</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-482">482</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-483">483</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-483">483</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-484">484</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-484">484</a></span>
@@ -4082,20 +4086,24 @@ This can be useful to store information on each title that you need later, like
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-487">487</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-487">487</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-488">488</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-488">488</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-489">489</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-489">489</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-490">490</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_titles--source--__span-0-477"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-477" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-477"></a><span class="nd">@abstractmethod</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-490">490</a></span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-478"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-478" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-478"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_titles</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Titles_T</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-491">491</a></span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-479"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-479" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-479"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-492">492</a></span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-480"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-480" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-480"></a><span class="sd"> Get Titles for the provided title ID.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-493">493</a></span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-481"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-481" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-481"></a> <span class="normal"><a href="#unshackle.core.service.Service.get_titles--source--__codelineno-0-494">494</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_titles--source--__span-0-481"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-481" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-481"></a><span class="nd">@abstractmethod</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-482"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-482" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-482"></a><span class="sd"> Return a Movies, Series, or Album objects containing Movie, Episode, or Song title objects respectively.</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-482"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-482" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-482"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_titles</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Titles_T</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-483"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-483" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-483"></a><span class="sd"> The returned data must be for the given title ID, or a spawn of the title ID.</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-483"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-483" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-483"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-484"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-484" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-484"></a> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-484"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-484" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-484"></a><span class="sd"> Get Titles for the provided title ID.</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-485"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-485" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-485"></a><span class="sd"> You must return at least one object. If you do not, unshackle presumes an invalid</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-485"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-485" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-485"></a>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-486"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-486" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-486"></a><span class="sd"> Title ID.</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-486"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-486" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-486"></a><span class="sd"> Return a Movies, Series, or Album objects containing Movie, Episode, or Song title objects respectively.</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-487"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-487" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-487"></a> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-487"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-487" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-487"></a><span class="sd"> The returned data must be for the given title ID, or a spawn of the title ID.</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-488"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-488" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-488"></a><span class="sd"> You can use the `data` dictionary class instance attribute of each Title to store data you may need later on.</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-488"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-488" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-488"></a>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-489"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-489" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-489"></a><span class="sd"> This can be useful to store information on each title that you need later, like any sub-asset IDs, or such.</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-489"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-489" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-489"></a><span class="sd"> You must return at least one object. If you do not, unshackle presumes an invalid</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-490"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-490" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-490"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_titles--source--__span-0-490"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-490" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-490"></a><span class="sd"> Title ID.</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-491"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-491" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-491"></a>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-492"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-492" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-492"></a><span class="sd"> You can use the `data` dictionary class instance attribute of each Title to store data you may need later on.</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-493"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-493" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-493"></a><span class="sd"> This can be useful to store information on each title that you need later, like any sub-asset IDs, or such.</span>
</span><span id="unshackle.core.service.Service.get_titles--source--__span-0-494"><a id="unshackle.core.service.Service.get_titles--source--__codelineno-0-494" name="unshackle.core.service.Service.get_titles--source--__codelineno-0-494"></a><span class="sd"> """</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -4177,11 +4185,7 @@ fallback to cached data when API calls fail.</p>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-492">492</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-496">496</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-493">493</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-494">494</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-495">495</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-496">496</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-497">497</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-497">497</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-498">498</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-498">498</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-499">499</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-499">499</a></span>
@@ -4212,42 +4216,46 @@ fallback to cached data when API calls fail.</p>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-524">524</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-524">524</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-525">525</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-525">525</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-526">526</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-526">526</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-527">527</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-492"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-492" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-492"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_titles_cached</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title_id</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Titles_T</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-527">527</a></span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-493"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-493" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-493"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-528">528</a></span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-494"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-494" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-494"></a><span class="sd"> Cached wrapper around get_titles() to reduce redundant API calls.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-529">529</a></span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-495"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-495" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-495"></a> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-530">530</a></span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-496"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-496" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-496"></a><span class="sd"> This method checks the cache before calling get_titles() and handles</span> <span class="normal"><a href="#unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-531">531</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-496"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-496" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-496"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_titles_cached</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title_id</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Titles_T</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-497"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-497" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-497"></a><span class="sd"> fallback to cached data when API calls fail.</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-497"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-497" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-497"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-498"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-498" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-498"></a> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-498"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-498" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-498"></a><span class="sd"> Cached wrapper around get_titles() to reduce redundant API calls.</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-499"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-499" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-499"></a><span class="sd"> Args:</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-499"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-499" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-499"></a>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-500"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-500" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-500"></a><span class="sd"> title_id: Optional title ID for cache key generation.</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-500"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-500" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-500"></a><span class="sd"> This method checks the cache before calling get_titles() and handles</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-501"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-501" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-501"></a><span class="sd"> If not provided, will try to extract from service instance.</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-501"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-501" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-501"></a><span class="sd"> fallback to cached data when API calls fail.</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-502"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-502" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-502"></a> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-502"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-502" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-502"></a>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-503"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-503" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-503"></a><span class="sd"> Returns:</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-503"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-503" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-503"></a><span class="sd"> Args:</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-504"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-504" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-504"></a><span class="sd"> Titles object (Movies, Series, or Album)</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-504"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-504" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-504"></a><span class="sd"> title_id: Optional title ID for cache key generation.</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-505"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-505" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-505"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-505"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-505" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-505"></a><span class="sd"> If not provided, will try to extract from service instance.</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-506"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-506" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-506"></a> <span class="n">identity</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cache_identity</span><span class="p">()</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-506"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-506" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-506"></a>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-507"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-507" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-507"></a> <span class="k">if</span> <span class="n">title_id</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-507"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-507" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-507"></a><span class="sd"> Returns:</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-508"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-508" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-508"></a> <span class="n">title_id</span> <span class="o">=</span> <span class="n">identity</span><span class="o">.</span><span class="n">title_id</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-508"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-508" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-508"></a><span class="sd"> Titles object (Movies, Series, or Album)</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-509"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-509" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-509"></a> <span class="k">if</span> <span class="n">title_id</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-509"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-509" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-509"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-510"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-510" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-510"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Cannot determine title_id for caching, bypassing cache"</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-510"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-510" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-510"></a> <span class="n">identity</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cache_identity</span><span class="p">()</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-511"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-511" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-511"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply_title_map</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_titles</span><span class="p">())</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-511"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-511" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-511"></a> <span class="k">if</span> <span class="n">title_id</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-512"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-512" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-512"></a> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-512"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-512" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-512"></a> <span class="n">title_id</span> <span class="o">=</span> <span class="n">identity</span><span class="o">.</span><span class="n">title_id</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-513"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-513" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-513"></a> <span class="n">no_cache</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-513"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-513" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-513"></a> <span class="k">if</span> <span class="n">title_id</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-514"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-514" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-514"></a> <span class="n">reset_cache</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-514"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-514" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-514"></a> <span class="bp">self</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Cannot determine title_id for caching, bypassing cache"</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-515"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-515" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-515"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-515"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-515" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-515"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply_title_map</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_titles</span><span class="p">())</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-516"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-516" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-516"></a> <span class="n">no_cache</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_cache"</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-516"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-516" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-516"></a>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-517"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-517" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-517"></a> <span class="n">reset_cache</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"reset_cache"</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-517"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-517" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-517"></a> <span class="n">no_cache</span> <span class="o">=</span> <span class="kc">False</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-518"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-518" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-518"></a> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-518"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-518" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-518"></a> <span class="n">reset_cache</span> <span class="o">=</span> <span class="kc">False</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-519"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-519" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-519"></a> <span class="n">titles</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">title_cache</span><span class="o">.</span><span class="n">get_cached_titles</span><span class="p">(</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-519"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-519" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-519"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-520"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-520" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-520"></a> <span class="n">title_id</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">title_id</span><span class="p">),</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-520"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-520" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-520"></a> <span class="n">no_cache</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_cache"</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-521"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-521" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-521"></a> <span class="n">fetch_function</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">get_titles</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-521"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-521" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-521"></a> <span class="n">reset_cache</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ctx</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"reset_cache"</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-522"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-522" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-522"></a> <span class="n">region</span><span class="o">=</span><span class="n">identity</span><span class="o">.</span><span class="n">region</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-522"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-522" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-522"></a>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-523"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-523" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-523"></a> <span class="n">account_hash</span><span class="o">=</span><span class="n">identity</span><span class="o">.</span><span class="n">account_hash</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-523"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-523" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-523"></a> <span class="n">titles</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">title_cache</span><span class="o">.</span><span class="n">get_cached_titles</span><span class="p">(</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-524"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-524" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-524"></a> <span class="n">no_cache</span><span class="o">=</span><span class="n">no_cache</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-524"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-524" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-524"></a> <span class="n">title_id</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">title_id</span><span class="p">),</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-525"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-525" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-525"></a> <span class="n">reset_cache</span><span class="o">=</span><span class="n">reset_cache</span><span class="p">,</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-525"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-525" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-525"></a> <span class="n">fetch_function</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">get_titles</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-526"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-526" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-526"></a> <span class="p">)</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-526"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-526" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-526"></a> <span class="n">region</span><span class="o">=</span><span class="n">identity</span><span class="o">.</span><span class="n">region</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-527"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-527" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-527"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply_title_map</span><span class="p">(</span><span class="n">titles</span><span class="p">)</span> </span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-527"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-527" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-527"></a> <span class="n">account_hash</span><span class="o">=</span><span class="n">identity</span><span class="o">.</span><span class="n">account_hash</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-528"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-528" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-528"></a> <span class="n">no_cache</span><span class="o">=</span><span class="n">no_cache</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-529"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-529" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-529"></a> <span class="n">reset_cache</span><span class="o">=</span><span class="n">reset_cache</span><span class="p">,</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-530"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-530" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-530"></a> <span class="p">)</span>
</span><span id="unshackle.core.service.Service.get_titles_cached--source--__span-0-531"><a id="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-531" name="unshackle.core.service.Service.get_titles_cached--source--__codelineno-0-531"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply_title_map</span><span class="p">(</span><span class="n">titles</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -4275,23 +4283,23 @@ title cache so config edits take effect without a cache reset, and before any
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-529">529</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-533">533</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-530">530</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-531">531</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-532">532</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-533">533</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-534">534</a></span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-534">534</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-535">535</a></span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-535">535</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-536">536</a></span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-536">536</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-537">537</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-529"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-529" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-529"></a><span class="k">def</span><span class="w"> </span><span class="nf">apply_title_map</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">titles</span><span class="p">:</span> <span class="n">Titles_T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Titles_T</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-537">537</a></span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-530"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-530" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-530"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-538">538</a></span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-531"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-531" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-531"></a><span class="sd"> Rewrite service-provided titles using the per-service ``title_map`` config.</span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-539">539</a></span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-532"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-532" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-532"></a> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-540">540</a></span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-533"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-533" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-533"></a><span class="sd"> ``title_map`` lives under ``services.&lt;TAG&gt;`` in unshackle.yaml. Applied after the</span> <span class="normal"><a href="#unshackle.core.service.Service.apply_title_map--source--__codelineno-0-541">541</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-533"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-533" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-533"></a><span class="k">def</span><span class="w"> </span><span class="nf">apply_title_map</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">titles</span><span class="p">:</span> <span class="n">Titles_T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Titles_T</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-534"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-534" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-534"></a><span class="sd"> title cache so config edits take effect without a cache reset, and before any</span> </span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-534"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-534" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-534"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-535"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-535" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-535"></a><span class="sd"> ``--enrich`` override so enrich wins. See ``remap_titles`` for the match rules.</span> </span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-535"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-535" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-535"></a><span class="sd"> Rewrite service-provided titles using the per-service ``title_map`` config.</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-536"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-536" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-536"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-536"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-536" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-536"></a>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-537"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-537" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-537"></a> <span class="k">return</span> <span class="n">remap_titles</span><span class="p">(</span><span class="n">titles</span><span class="p">,</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span> <span class="ow">or</span> <span class="p">{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"title_map"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">{})</span> </span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-537"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-537" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-537"></a><span class="sd"> ``title_map`` lives under ``services.&lt;TAG&gt;`` in unshackle.yaml. Applied after the</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-538"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-538" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-538"></a><span class="sd"> title cache so config edits take effect without a cache reset, and before any</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-539"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-539" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-539"></a><span class="sd"> ``--enrich`` override so enrich wins. See ``remap_titles`` for the match rules.</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-540"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-540" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-540"></a><span class="sd"> """</span>
</span><span id="unshackle.core.service.Service.apply_title_map--source--__span-0-541"><a id="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-541" name="unshackle.core.service.Service.apply_title_map--source--__codelineno-0-541"></a> <span class="k">return</span> <span class="n">remap_titles</span><span class="p">(</span><span class="n">titles</span><span class="p">,</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">config</span> <span class="ow">or</span> <span class="p">{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"title_map"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">{})</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -4338,11 +4346,7 @@ the Track's media data, then do.</p>
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-539">539</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-543">543</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-540">540</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-541">541</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-542">542</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-543">543</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-544">544</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-544">544</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-545">545</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-545">545</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-546">546</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-546">546</a></span>
@@ -4367,36 +4371,40 @@ the Track's media data, then do.</p>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-565">565</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-565">565</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-566">566</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-566">566</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-567">567</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-567">567</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-568">568</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_tracks--source--__span-0-539"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-539" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-539"></a><span class="nd">@abstractmethod</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-568">568</a></span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-540"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-540" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-540"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_tracks</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Tracks</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-569">569</a></span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-541"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-541" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-541"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-570">570</a></span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-542"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-542" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-542"></a><span class="sd"> Get Track objects of the Title.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-571">571</a></span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-543"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-543" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-543"></a> <span class="normal"><a href="#unshackle.core.service.Service.get_tracks--source--__codelineno-0-572">572</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_tracks--source--__span-0-543"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-543" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-543"></a><span class="nd">@abstractmethod</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-544"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-544" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-544"></a><span class="sd"> Return a Tracks object, which itself can contain Video, Audio, Subtitle or even Chapters.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-544"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-544" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-544"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_tracks</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Tracks</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-545"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-545" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-545"></a><span class="sd"> Tracks.videos, Tracks.audio, Tracks.subtitles, and Track.chapters should be a List of Track objects.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-545"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-545" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-545"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-546"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-546" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-546"></a> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-546"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-546" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-546"></a><span class="sd"> Get Track objects of the Title.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-547"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-547" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-547"></a><span class="sd"> Each Track in the Tracks should represent a Video/Audio track, Representation, or</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-547"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-547" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-547"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-548"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-548" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-548"></a><span class="sd"> Adaptation, or a Subtitle file.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-548"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-548" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-548"></a><span class="sd"> Return a Tracks object, which itself can contain Video, Audio, Subtitle or even Chapters.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-549"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-549" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-549"></a> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-549"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-549" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-549"></a><span class="sd"> Tracks.videos, Tracks.audio, Tracks.subtitles, and Track.chapters should be a List of Track objects.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-550"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-550" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-550"></a><span class="sd"> While one Track should only hold information for one downloadable track, try to get as many</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-550"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-550" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-550"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-551"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-551" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-551"></a><span class="sd"> unique Track objects per track type so track selection by the root code can give you more</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-551"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-551" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-551"></a><span class="sd"> Each Track in the Tracks should represent a Video/Audio track, Representation, or</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-552"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-552" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-552"></a><span class="sd"> options in terms of Resolution, Bitrate, Codecs, Language, and such.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-552"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-552" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-552"></a><span class="sd"> Adaptation, or a Subtitle file.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-553"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-553" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-553"></a> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-553"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-553" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-553"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-554"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-554" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-554"></a><span class="sd"> No decision making or filtering of which Tracks get returned should happen here. It can be</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-554"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-554" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-554"></a><span class="sd"> While one Track should only hold information for one downloadable track, try to get as many</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-555"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-555" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-555"></a><span class="sd"> considered an error to filter for e.g. resolution, codec, and such. All filtering based on</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-555"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-555" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-555"></a><span class="sd"> unique Track objects per track type so track selection by the root code can give you more</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-556"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-556" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-556"></a><span class="sd"> arguments will be done by the root code automatically when needed.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-556"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-556" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-556"></a><span class="sd"> options in terms of Resolution, Bitrate, Codecs, Language, and such.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-557"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-557" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-557"></a> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-557"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-557" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-557"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-558"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-558" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-558"></a><span class="sd"> Make sure you correctly mark which Tracks have encryption, and which DRM System they</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-558"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-558" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-558"></a><span class="sd"> No decision making or filtering of which Tracks get returned should happen here. It can be</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-559"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-559" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-559"></a><span class="sd"> use, with the `drm` property.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-559"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-559" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-559"></a><span class="sd"> considered an error to filter for e.g. resolution, codec, and such. All filtering based on</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-560"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-560" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-560"></a> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-560"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-560" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-560"></a><span class="sd"> arguments will be done by the root code automatically when needed.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-561"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-561" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-561"></a><span class="sd"> If you can get the Track's KID (Key ID) as a 32 char (16 bit) HEX string, give it to the</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-561"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-561" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-561"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-562"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-562" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-562"></a><span class="sd"> Track's `kid` variable, as it will speed up the decryption process later on. The service</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-562"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-562" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-562"></a><span class="sd"> Make sure you correctly mark which Tracks have encryption, and which DRM System they</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-563"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-563" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-563"></a><span class="sd"> decides whether it is necessary. Generally if you can give it, without downloading any of</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-563"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-563" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-563"></a><span class="sd"> use, with the `drm` property.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-564"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-564" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-564"></a><span class="sd"> the Track's media data, then do.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-564"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-564" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-564"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-565"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-565" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-565"></a> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-565"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-565" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-565"></a><span class="sd"> If you can get the Track's KID (Key ID) as a 32 char (16 bit) HEX string, give it to the</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-566"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-566" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-566"></a><span class="sd"> :param title: The current `Title` from get_titles that unshackle processes now.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-566"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-566" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-566"></a><span class="sd"> Track's `kid` variable, as it will speed up the decryption process later on. The service</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-567"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-567" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-567"></a><span class="sd"> :return: Tracks object containing Video, Audio, Subtitles, and Chapters, if available.</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-567"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-567" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-567"></a><span class="sd"> decides whether it is necessary. Generally if you can give it, without downloading any of</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-568"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-568" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-568"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-568"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-568" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-568"></a><span class="sd"> the Track's media data, then do.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-569"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-569" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-569"></a>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-570"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-570" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-570"></a><span class="sd"> :param title: The current `Title` from get_titles that unshackle processes now.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-571"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-571" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-571"></a><span class="sd"> :return: Tracks object containing Video, Audio, Subtitles, and Chapters, if available.</span>
</span><span id="unshackle.core.service.Service.get_tracks--source--__span-0-572"><a id="unshackle.core.service.Service.get_tracks--source--__codelineno-0-572" name="unshackle.core.service.Service.get_tracks--source--__codelineno-0-572"></a><span class="sd"> """</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
@@ -4463,11 +4471,7 @@ option <code>chapter_fallback_name</code>. For example, <code>"Chapter {i:02}"</
<details class="mkdocstrings-source"> <details class="mkdocstrings-source">
<summary>Source code in <code>unshackle/core/service.py</code></summary> <summary>Source code in <code>unshackle/core/service.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-570">570</a></span> <div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-574">574</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-571">571</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-572">572</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-573">573</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-574">574</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-575">575</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-575">575</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-576">576</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-576">576</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-577">577</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-577">577</a></span>
@@ -4480,24 +4484,28 @@ option <code>chapter_fallback_name</code>. For example, <code>"Chapter {i:02}"</
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-584">584</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-584">584</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-585">585</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-585">585</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-586">586</a></span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-586">586</a></span>
<span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-587">587</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_chapters--source--__span-0-570"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-570" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-570"></a><span class="nd">@abstractmethod</span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-587">587</a></span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-571"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-571" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-571"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_chapters</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Chapters</span><span class="p">:</span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-588">588</a></span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-572"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-572" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-572"></a><span class="w"> </span><span class="sd">"""</span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-589">589</a></span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-573"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-573" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-573"></a><span class="sd"> Get Chapters for the Title.</span> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-590">590</a></span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-574"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-574" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-574"></a> <span class="normal"><a href="#unshackle.core.service.Service.get_chapters--source--__codelineno-0-591">591</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="unshackle.core.service.Service.get_chapters--source--__span-0-574"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-574" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-574"></a><span class="nd">@abstractmethod</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-575"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-575" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-575"></a><span class="sd"> Parameters:</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-575"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-575" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-575"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_chapters</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="p">:</span> <span class="n">Title_T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Chapters</span><span class="p">:</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-576"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-576" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-576"></a><span class="sd"> title: The current Title from `get_titles` that unshackle processes now.</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-576"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-576" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-576"></a><span class="w"> </span><span class="sd">"""</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-577"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-577" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-577"></a> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-577"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-577" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-577"></a><span class="sd"> Get Chapters for the Title.</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-578"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-578" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-578"></a><span class="sd"> You must return a Chapters object containing 0 or more Chapter objects.</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-578"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-578" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-578"></a>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-579"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-579" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-579"></a> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-579"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-579" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-579"></a><span class="sd"> Parameters:</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-580"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-580" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-580"></a><span class="sd"> You do not need to set a Chapter number or sort/order the chapters in any way as</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-580"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-580" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-580"></a><span class="sd"> title: The current Title from `get_titles` that unshackle processes now.</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-581"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-581" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-581"></a><span class="sd"> the Chapters class automatically handles all of that for you. If there is no</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-581"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-581" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-581"></a>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-582"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-582" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-582"></a><span class="sd"> descriptive name for a Chapter then do not set a name at all.</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-582"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-582" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-582"></a><span class="sd"> You must return a Chapters object containing 0 or more Chapter objects.</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-583"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-583" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-583"></a> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-583"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-583" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-583"></a>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-584"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-584" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-584"></a><span class="sd"> You must not set Chapter names to "Chapter {n}" or such. If you (or the user)</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-584"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-584" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-584"></a><span class="sd"> You do not need to set a Chapter number or sort/order the chapters in any way as</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-585"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-585" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-585"></a><span class="sd"> wants "Chapter {n}" style Chapter names (or similar) then they can use the config</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-585"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-585" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-585"></a><span class="sd"> the Chapters class automatically handles all of that for you. If there is no</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-586"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-586" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-586"></a><span class="sd"> option `chapter_fallback_name`. For example, `"Chapter {i:02}"` for "Chapter 01".</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-586"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-586" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-586"></a><span class="sd"> descriptive name for a Chapter then do not set a name at all.</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-587"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-587" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-587"></a><span class="sd"> """</span> </span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-587"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-587" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-587"></a>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-588"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-588" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-588"></a><span class="sd"> You must not set Chapter names to "Chapter {n}" or such. If you (or the user)</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-589"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-589" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-589"></a><span class="sd"> wants "Chapter {n}" style Chapter names (or similar) then they can use the config</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-590"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-590" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-590"></a><span class="sd"> option `chapter_fallback_name`. For example, `"Chapter {i:02}"` for "Chapter 01".</span>
</span><span id="unshackle.core.service.Service.get_chapters--source--__span-0-591"><a id="unshackle.core.service.Service.get_chapters--source--__codelineno-0-591" name="unshackle.core.service.Service.get_chapters--source--__codelineno-0-591"></a><span class="sd"> """</span>
</span></code></pre></div></td></tr></table></div> </span></code></pre></div></td></tr></table></div>
</details> </details>
</div> </div>
File diff suppressed because one or more lines are too long