mirror of
https://github.com/kennethreitz/responder.git
synced 2026-10-24 05:59:12 +00:00
371 lines
28 KiB
HTML
371 lines
28 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="./">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>Runtime Contracts — responder 9.2.0 documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=5ecbeea2" />
|
||
<link rel="stylesheet" type="text/css" href="_static/basic.css?v=b08954a9" />
|
||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=eb4102c5" />
|
||
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
|
||
<link rel="stylesheet" type="text/css" href="_static/sphinx-design.min.css?v=95c83b7e" />
|
||
<link rel="stylesheet" type="text/css" href="_static/design-elements.e5416f61bae5d36adc6d722a2b6f8cff.css?v=452a8e97" />
|
||
<script src="_static/documentation_options.js?v=e8b940be"></script>
|
||
<script src="_static/doctools.js?v=fd6eb6e6"></script>
|
||
<script src="_static/sphinx_highlight.js?v=6ffebe34"></script>
|
||
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
|
||
<script src="_static/copybutton.js?v=fd10adb8"></script>
|
||
<script>
|
||
</script>
|
||
<script src="_static/design-tabs.js?v=f930bc37"></script>
|
||
<script src="_static/design-elements.bbdccc18c4abea9397628f9fea3d48c2.js?v=03c7770e"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="Changelog" href="changes.html" />
|
||
<link rel="prev" title="Command Line Interface" href="cli.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
|
||
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<section id="runtime-contracts">
|
||
<h1>Runtime Contracts<a class="headerlink" href="#runtime-contracts" title="Link to this heading">¶</a></h1>
|
||
<p>Responder keeps a small set of runtime contracts stable across the 9.x series.
|
||
This page collects the behaviors that application code, tests, generated
|
||
clients, and OpenAPI consumers can rely on.</p>
|
||
<section id="error-responses">
|
||
<h2>Error Responses<a class="headerlink" href="#error-responses" title="Link to this heading">¶</a></h2>
|
||
<p>Framework-generated errors use <code class="docutils literal notranslate"><span class="pre">application/problem+json</span></code> by default. The
|
||
payload always includes:</p>
|
||
<ul class="simple">
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">type</span></code>: <code class="docutils literal notranslate"><span class="pre">"about:blank"</span></code> unless an application <code class="docutils literal notranslate"><span class="pre">problem_handler</span></code> changes
|
||
it or the error was raised as a <code class="docutils literal notranslate"><span class="pre">responder.Problem</span></code> with an explicit
|
||
<code class="docutils literal notranslate"><span class="pre">type</span></code>.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">title</span></code>: the HTTP status title.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">status</span></code>: the numeric HTTP status code.</p></li>
|
||
</ul>
|
||
<p>When extra context exists, the payload may also include:</p>
|
||
<ul class="simple">
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">detail</span></code> for human-readable context.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">errors</span></code> for structured validation failures.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">request_id</span></code> when request ID middleware or structured logging has attached
|
||
one to the request scope.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">instance</span></code> (defaulting to the request path) plus any extension members when
|
||
the error was raised as a <code class="docutils literal notranslate"><span class="pre">responder.Problem</span></code>.</p></li>
|
||
</ul>
|
||
<p>The standard framework error statuses are:</p>
|
||
<table class="docutils align-default">
|
||
<thead>
|
||
<tr class="row-odd"><th class="head"><p>Status</p></th>
|
||
<th class="head"><p>Default title</p></th>
|
||
<th class="head"><p>Notes</p></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">400</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Bad</span> <span class="pre">Request</span></code></p></td>
|
||
<td><p>Malformed request bodies, such as invalid JSON.</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">401</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Unauthorized</span></code></p></td>
|
||
<td><p>Authentication failed or credentials were missing.</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">403</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Forbidden</span></code></p></td>
|
||
<td><p>Authentication succeeded, but the principal lacks required scope.</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">404</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Not</span> <span class="pre">Found</span></code></p></td>
|
||
<td><p>No route matched the request path.</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">405</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Method</span> <span class="pre">Not</span> <span class="pre">Allowed</span></code></p></td>
|
||
<td><p>The path exists but does not accept the request method.</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">413</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Content</span> <span class="pre">Too</span> <span class="pre">Large</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">max_request_size</span></code> rejected the body.</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">422</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Validation</span> <span class="pre">Error</span></code></p></td>
|
||
<td><p>Path, query, header, cookie, form, file, or body validation failed.</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">500</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Internal</span> <span class="pre">Server</span> <span class="pre">Error</span></code></p></td>
|
||
<td><p>Unhandled application errors and response-model validation failures.</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">504</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">Gateway</span> <span class="pre">Timeout</span></code></p></td>
|
||
<td><p><code class="docutils literal notranslate"><span class="pre">request_timeout</span></code> expired before the handler finished.</p></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Pass <code class="docutils literal notranslate"><span class="pre">API(problem_details=False)</span></code> to keep the legacy behavior. In that mode,
|
||
requests that ask for JSON receive <code class="docutils literal notranslate"><span class="pre">{"error":</span> <span class="pre">"..."}</span></code>, while validation
|
||
failures receive <code class="docutils literal notranslate"><span class="pre">{"errors":</span> <span class="pre">[...]}</span></code>. Requests that do not ask for JSON may
|
||
receive plain text, matching older Responder releases.</p>
|
||
<p><code class="docutils literal notranslate"><span class="pre">API(problem_handler=...)</span></code> can enrich or replace problem-details payloads. The
|
||
handler receives <code class="docutils literal notranslate"><span class="pre">(payload,</span> <span class="pre">request,</span> <span class="pre">exc)</span></code>; returning <code class="docutils literal notranslate"><span class="pre">None</span></code> means the
|
||
payload was mutated in place. If the handler raises or returns a non-dict value,
|
||
Responder logs the failure and uses the original framework payload.</p>
|
||
</section>
|
||
<section id="authentication">
|
||
<h2>Authentication<a class="headerlink" href="#authentication" title="Link to this heading">¶</a></h2>
|
||
<p>Application-level auth configured with <code class="docutils literal notranslate"><span class="pre">API(auth=...)</span></code> applies to every route
|
||
by default. A route can opt out with <code class="docutils literal notranslate"><span class="pre">auth=None</span></code> or replace it with
|
||
<code class="docutils literal notranslate"><span class="pre">auth=...</span></code> on the route decorator.</p>
|
||
<p>Auth helpers inject the authenticated principal as <code class="docutils literal notranslate"><span class="pre">user</span></code>, <code class="docutils literal notranslate"><span class="pre">principal</span></code>, and
|
||
<code class="docutils literal notranslate"><span class="pre">auth</span></code> when the route declares those keyword-only parameters. They also set
|
||
<code class="docutils literal notranslate"><span class="pre">req.state.user</span></code> and <code class="docutils literal notranslate"><span class="pre">req.state.auth</span></code>.</p>
|
||
<p><code class="docutils literal notranslate"><span class="pre">auth.optional()</span></code> only treats missing credentials as anonymous. Malformed
|
||
credentials, wrong schemes, bad API keys, and failed verification still fail
|
||
through the wrapped auth scheme. For scoped auth, anonymous requests are allowed
|
||
when credentials are missing, but supplied credentials must still satisfy the
|
||
required scopes.</p>
|
||
<p>Scoped auth returns <code class="docutils literal notranslate"><span class="pre">403</span></code> when a principal is authenticated but does not hold
|
||
every required scope or role. If the wrapped scheme provides a challenge,
|
||
Responder adds an <code class="docutils literal notranslate"><span class="pre">insufficient_scope</span></code> <code class="docutils literal notranslate"><span class="pre">WWW-Authenticate</span></code> challenge with the
|
||
missing scopes.</p>
|
||
<p><code class="docutils literal notranslate"><span class="pre">api.policy(name,</span> <span class="pre">auth)</span></code> creates a named wrapper around an auth helper. The
|
||
policy name is an application label only: authentication, principal injection,
|
||
OpenAPI security schemes, optional auth, and scoped requirements all continue to
|
||
come from the wrapped helper.</p>
|
||
</section>
|
||
<section id="dependency-injection">
|
||
<h2>Dependency Injection<a class="headerlink" href="#dependency-injection" title="Link to this heading">¶</a></h2>
|
||
<p>Responder resolves route dependencies after before-request hooks and auth, and
|
||
before the route handler. For HTTP requests, the order is:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Before-request hooks.</p></li>
|
||
<li><p>Route or application auth.</p></li>
|
||
<li><p>Route dependency guards.</p></li>
|
||
<li><p>Handler parameter dependencies.</p></li>
|
||
<li><p>Handler.</p></li>
|
||
<li><p>After-request hooks.</p></li>
|
||
<li><p>Request-scoped dependency teardown.</p></li>
|
||
</ol>
|
||
<p>Each dependency is resolved at most once per request. Shared sub-dependencies
|
||
reuse the same value within that request.</p>
|
||
<p>Generator dependencies tear down in reverse dependency order. Teardown failures
|
||
are logged, and remaining teardowns still run.</p>
|
||
<p>App-scoped dependencies are resolved once for the application lifetime and are
|
||
protected by a lock during first resolution, so concurrent first users share the
|
||
same initialized value. If first initialization raises, the failed value is not
|
||
cached and a later request may retry. App-scoped teardowns run during lifespan
|
||
shutdown and clear the app-scope cache.</p>
|
||
<p>App-scoped dependencies may depend on other app-scoped dependencies, but they
|
||
cannot receive the request object and cannot depend on request-scoped
|
||
dependencies.</p>
|
||
</section>
|
||
<section id="response-contracts">
|
||
<h2>Response Contracts<a class="headerlink" href="#response-contracts" title="Link to this heading">¶</a></h2>
|
||
<p>A supported handler return annotation is the response contract. Pydantic
|
||
models, dataclasses, typed dictionaries, collections, unions, pagination
|
||
models, and JSON scalars are inferred through Pydantic <code class="docutils literal notranslate"><span class="pre">TypeAdapter</span></code>. The
|
||
same contract drives runtime validation and serialization, OpenAPI, and
|
||
generated-client types. <code class="docutils literal notranslate"><span class="pre">response_model=...</span></code> declares the same contract
|
||
explicitly; <code class="docutils literal notranslate"><span class="pre">response_model=False</span></code> disables both inference and validation.</p>
|
||
<p>Validation runs after the handler and after-request hooks. Valid responses are
|
||
coerced and filtered through the contract. Invalid responses fail closed:</p>
|
||
<ul class="simple">
|
||
<li><p>In normal mode, the client receives a <code class="docutils literal notranslate"><span class="pre">500</span></code> framework error.</p></li>
|
||
<li><p>In debug mode, the validation exception is raised for the developer.</p></li>
|
||
</ul>
|
||
<p>Response-contract validation failures are passed to <code class="docutils literal notranslate"><span class="pre">problem_handler</span></code> as the
|
||
<code class="docutils literal notranslate"><span class="pre">exc</span></code> argument when problem details are enabled.</p>
|
||
<p>String and bytes return annotations default to <code class="docutils literal notranslate"><span class="pre">text/plain</span></code> and
|
||
<code class="docutils literal notranslate"><span class="pre">application/octet-stream</span></code>. Other inferred contracts default to
|
||
<code class="docutils literal notranslate"><span class="pre">application/json</span></code>. Error responses (<code class="docutils literal notranslate"><span class="pre">4xx</span></code>/<code class="docutils literal notranslate"><span class="pre">5xx</span></code>) are not validated
|
||
against the success contract. Declare a status-specific contract when the
|
||
handler owns that response shape:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nd">@api</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"/items/</span><span class="si">{item_id}</span><span class="s2">"</span><span class="p">,</span> <span class="n">responses</span><span class="o">=</span><span class="p">{</span><span class="mi">404</span><span class="p">:</span> <span class="n">NotFound</span><span class="p">})</span>
|
||
<span class="k">def</span><span class="w"> </span><span class="nf">get_item</span><span class="p">(</span><span class="n">req</span><span class="p">,</span> <span class="n">resp</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">item_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">ItemOut</span><span class="p">:</span>
|
||
<span class="k">if</span> <span class="n">item</span> <span class="o">:=</span> <span class="n">find_item</span><span class="p">(</span><span class="n">item_id</span><span class="p">):</span>
|
||
<span class="k">return</span> <span class="n">item</span>
|
||
<span class="k">return</span> <span class="n">NotFound</span><span class="p">(</span><span class="n">detail</span><span class="o">=</span><span class="s2">"Item not found"</span><span class="p">),</span> <span class="mi">404</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>For additional OpenAPI metadata, use <code class="docutils literal notranslate"><span class="pre">responses={404:</span> <span class="pre">{"model":</span> <span class="pre">NotFound,</span>
|
||
<span class="pre">"description":</span> <span class="pre">"Item</span> <span class="pre">not</span> <span class="pre">found"}}</span></code>. Status-specific contracts validate the
|
||
final body just like the success contract. Informational, <code class="docutils literal notranslate"><span class="pre">204</span></code>, <code class="docutils literal notranslate"><span class="pre">205</span></code>,
|
||
and <code class="docutils literal notranslate"><span class="pre">304</span></code> responses cannot declare a body contract and never send content,
|
||
even if a handler assigned or returned a body; <code class="docutils literal notranslate"><span class="pre">HEAD</span></code> validates the
|
||
corresponding <code class="docutils literal notranslate"><span class="pre">GET</span></code> contract but sends headers only.</p>
|
||
</section>
|
||
<section id="typed-event-streams">
|
||
<h2>Typed Event Streams<a class="headerlink" href="#typed-event-streams" title="Link to this heading">¶</a></h2>
|
||
<p><code class="docutils literal notranslate"><span class="pre">@api.sse</span></code> and <code class="docutils literal notranslate"><span class="pre">@api.ndjson</span></code> extend response contracts to incremental
|
||
responses. Annotate a sync or async iterator and Responder infers its item
|
||
type through the same Pydantic <code class="docutils literal notranslate"><span class="pre">TypeAdapter</span></code> path used for buffered return
|
||
annotations:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">collections.abc</span><span class="w"> </span><span class="kn">import</span> <span class="n">AsyncIterator</span>
|
||
|
||
<span class="nd">@api</span><span class="o">.</span><span class="n">ndjson</span><span class="p">(</span><span class="s2">"/items"</span><span class="p">)</span>
|
||
<span class="k">async</span> <span class="k">def</span><span class="w"> </span><span class="nf">items</span><span class="p">(</span><span class="n">req</span><span class="p">,</span> <span class="n">resp</span><span class="p">)</span> <span class="o">-></span> <span class="n">AsyncIterator</span><span class="p">[</span><span class="n">ItemOut</span><span class="p">]:</span>
|
||
<span class="k">async</span> <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">store</span><span class="o">.</span><span class="n">iter_items</span><span class="p">():</span>
|
||
<span class="k">yield</span> <span class="n">item</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Use <code class="docutils literal notranslate"><span class="pre">event_model=</span></code> or <code class="docutils literal notranslate"><span class="pre">item_model=</span></code> when the return annotation cannot
|
||
express the contract. SSE routes may annotate <code class="docutils literal notranslate"><span class="pre">AsyncIterator[SSE[ItemOut]]</span></code>;
|
||
the envelope’s <code class="docutils literal notranslate"><span class="pre">data</span></code> is validated as <code class="docutils literal notranslate"><span class="pre">ItemOut</span></code> while <code class="docutils literal notranslate"><span class="pre">event</span></code>, <code class="docutils literal notranslate"><span class="pre">id</span></code>,
|
||
<code class="docutils literal notranslate"><span class="pre">retry</span></code>, and comment metadata remain protocol fields.</p>
|
||
<p>OpenAPI describes the wire media type and includes the item schema in the
|
||
<code class="docutils literal notranslate"><span class="pre">x-responder-item-schema</span></code> media extension. Responder’s generated Python,
|
||
JavaScript, TypeScript, Ruby, and PHP clients recognize that extension and
|
||
produce lazy streaming iterators rather than buffering the response.</p>
|
||
<p>An immediately available first item is validated before headers. Later
|
||
validation or producer failures are logged and terminate the stream without
|
||
emitting the broken item. Debug mode re-raises the failure. Idle SSE routes
|
||
with <code class="docutils literal notranslate"><span class="pre">heartbeat=</span></code> begin the response without waiting indefinitely for their
|
||
first event, allowing keepalives to flow; their first eventual item is still
|
||
validated before it is written.</p>
|
||
</section>
|
||
<section id="openapi-defaults">
|
||
<h2>OpenAPI Defaults<a class="headerlink" href="#openapi-defaults" title="Link to this heading">¶</a></h2>
|
||
<p>When OpenAPI is enabled, Responder generates operation IDs, summaries, tags,
|
||
request bodies, response schemas, validation responses, auth security
|
||
requirements, and common framework error responses from the route contract.
|
||
Route decorators can add or override operation metadata with <code class="docutils literal notranslate"><span class="pre">responses=</span></code>,
|
||
<code class="docutils literal notranslate"><span class="pre">examples=</span></code>, <code class="docutils literal notranslate"><span class="pre">response_examples=</span></code>, and <code class="docutils literal notranslate"><span class="pre">openapi_extra=</span></code>; nested response
|
||
metadata is deep-merged with the generated contract.</p>
|
||
<p><code class="docutils literal notranslate"><span class="pre">status_code=</span></code> declares the route’s default success status: the generated
|
||
operation keys its success response under it instead of <code class="docutils literal notranslate"><span class="pre">200</span></code> (informational,
|
||
<code class="docutils literal notranslate"><span class="pre">204</span></code>, <code class="docutils literal notranslate"><span class="pre">205</span></code>, and <code class="docutils literal notranslate"><span class="pre">304</span></code> statuses document no response body), and
|
||
<code class="docutils literal notranslate"><span class="pre">resp.status_code</span></code> is pre-seeded with it before the handler runs. An explicit
|
||
assignment in the handler — or a before-request hook short-circuiting the route
|
||
— still wins.</p>
|
||
<p>The generated document is cached: registering a route, schema, or security
|
||
scheme invalidates the cache, and the next request to the schema route (or
|
||
docs page) rebuilds it.</p>
|
||
<p>With problem details enabled, generated operations document
|
||
<code class="docutils literal notranslate"><span class="pre">application/problem+json</span></code> responses and the reusable <code class="docutils literal notranslate"><span class="pre">ProblemDetails</span></code>
|
||
component schema. With <code class="docutils literal notranslate"><span class="pre">problem_details=False</span></code>, generated operations document
|
||
the legacy JSON error shape and do not register <code class="docutils literal notranslate"><span class="pre">ProblemDetails</span></code>.</p>
|
||
<p>Generated OpenAPI documents are validated in the test suite for both OpenAPI
|
||
3.0.x and 3.1.x.</p>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper"><p class="logo">
|
||
<a href="index.html">
|
||
<img class="logo" src="_static/responder.png" />
|
||
</a>
|
||
</p>
|
||
<p>
|
||
<strong>Responder</strong> — a familiar HTTP service framework for Python.
|
||
<br />
|
||
<small>v9.2.0</small>
|
||
</p>
|
||
<h3>Useful Links</h3>
|
||
<ul>
|
||
<li><a href="https://github.com/kennethreitz/responder">Responder @ GitHub</a></li>
|
||
<li><a href="https://pypi.org/project/responder/">Responder @ PyPI</a></li>
|
||
<li><a href="https://github.com/kennethreitz/responder/issues">Issue Tracker</a></li>
|
||
</ul><h3>Navigation</h3>
|
||
<p class="caption" role="heading"><span class="caption-text">User Guide</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quick Start</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tour.html">Feature Tour</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="routers.html">Composing Apps with Routers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="guide-config.html">Configuration</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="clientgen.html">Generated Clients</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="deployment.html">Deployment</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing</a></li>
|
||
</ul>
|
||
<p class="caption" role="heading"><span class="caption-text">Tutorials</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-rest.html">Building a REST API</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-sqlalchemy.html">Using SQLAlchemy</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-auth.html">Authentication</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-websockets.html">WebSocket Tutorial</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-middleware.html">Writing Middleware</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tutorial-flask.html">Migrating from Flask</a></li>
|
||
</ul>
|
||
<p class="caption" role="heading"><span class="caption-text">Reference</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1"><a class="reference internal" href="api.html">API Reference</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="cli.html">Command Line Interface</a></li>
|
||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Runtime Contracts</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="#error-responses">Error Responses</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#authentication">Authentication</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#dependency-injection">Dependency Injection</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#response-contracts">Response Contracts</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#typed-event-streams">Typed Event Streams</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#openapi-defaults">OpenAPI Defaults</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p class="caption" role="heading"><span class="caption-text">Project</span></p>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="changes.html">Changelog</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v9.html">Migrating to v9</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v8.html">Migrating to v8</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v7.html">Migrating to v7</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v6.html">Migrating to v6</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="migration-v5.html">Migrating to v5</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="sandbox.html">Sandbox</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="backlog.html">Backlog</a></li>
|
||
</ul>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="index.html">Documentation overview</a><ul>
|
||
<li>Previous: <a href="cli.html" title="previous chapter">Command Line Interface</a></li>
|
||
<li>Next: <a href="changes.html" title="next chapter">Changelog</a></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2018-2026, Kenneth Reitz.
|
||
|
||
|
|
||
<a href="_sources/runtime-contracts.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
<a href="https://github.com/kennethreitz/responder" class="github">
|
||
<img src="_static/forkme_right_darkblue.png" alt="Fork me on GitHub" class="github"/>
|
||
</a>
|
||
|
||
|
||
|
||
</body>
|
||
</html> |