2408 lines
161 KiB
HTML
2408 lines
161 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>gRPC — gRPC Python 1.32.0 documentation</title>
|
||
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||
<script src="_static/jquery.js"></script>
|
||
<script src="_static/underscore.js"></script>
|
||
<script src="_static/doctools.js"></script>
|
||
<script src="_static/language_data.js"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="gRPC AsyncIO API" href="grpc_asyncio.html" />
|
||
<link rel="prev" title="Welcome to gRPC Python’s documentation!" href="index.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
<div class="document">
|
||
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h1 class="logo"><a href="index.html">gRPC Python</a></h1>
|
||
|
||
|
||
|
||
<p class="blurb">1.32.0</p>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3>
|
||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1 current"><a class="current reference internal" href="#">gRPC</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="#tutorial">Tutorial</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#example">Example</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="#module-contents">Module Contents</a><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="#version">Version</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#create-client">Create Client</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#create-client-credentials">Create Client Credentials</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#create-server">Create Server</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#create-server-credentials">Create Server Credentials</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#local-connection-type">Local Connection Type</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#rpc-method-handlers">RPC Method Handlers</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#channel-ready-future">Channel Ready Future</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#channel-connectivity">Channel Connectivity</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#grpc-status-code">gRPC Status Code</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#channel-object">Channel Object</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#server-object">Server Object</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#authentication-authorization-objects">Authentication & Authorization Objects</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#grpc-exceptions">gRPC Exceptions</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#shared-context">Shared Context</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#client-side-context">Client-Side Context</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#client-side-interceptor">Client-Side Interceptor</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#service-side-context">Service-Side Context</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#service-side-handler">Service-Side Handler</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#service-side-interceptor">Service-Side Interceptor</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#multi-callable-interfaces">Multi-Callable Interfaces</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#future-interfaces">Future Interfaces</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#compression">Compression</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="#runtime-protobuf-parsing">Runtime Protobuf Parsing</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="grpc_asyncio.html">gRPC AsyncIO API</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="grpc_channelz.html">gRPC Channelz</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="grpc_health_checking.html">gRPC Health Checking</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="grpc_reflection.html">gRPC Reflection</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="grpc_status.html">gRPC Status</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="grpc_testing.html">gRPC Testing</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
|
||
</ul>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="index.html">Documentation overview</a><ul>
|
||
<li>Previous: <a href="index.html" title="previous chapter">Welcome to gRPC Python’s documentation!</a></li>
|
||
<li>Next: <a href="grpc_asyncio.html" title="next chapter">gRPC AsyncIO API</a></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div 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" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="module-grpc">
|
||
<span id="grpc"></span><h1>gRPC<a class="headerlink" href="#module-grpc" title="Permalink to this headline">¶</a></h1>
|
||
<div class="section" id="tutorial">
|
||
<h2>Tutorial<a class="headerlink" href="#tutorial" title="Permalink to this headline">¶</a></h2>
|
||
<p>If you want to see gRPC in action first, visit the <a class="reference external" href="https://grpc.io/docs/languages/python/quickstart">Python Quickstart</a>.
|
||
Or, if you would like dive in with more extensive usage of gRPC Python, check <a class="reference external" href="https://grpc.io/docs/languages/python/basics">gRPC Basics - Python</a> out.</p>
|
||
</div>
|
||
<div class="section" id="example">
|
||
<h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
|
||
<p>Go to <a class="reference external" href="https://github.com/grpc/grpc/tree/master/examples/python">gRPC Python Examples</a></p>
|
||
</div>
|
||
<div class="section" id="module-contents">
|
||
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2>
|
||
<div class="section" id="version">
|
||
<h3>Version<a class="headerlink" href="#version" title="Permalink to this headline">¶</a></h3>
|
||
<p>The version string is available as <code class="code docutils literal notranslate"><span class="pre">grpc.__version__</span></code>.</p>
|
||
</div>
|
||
<div class="section" id="create-client">
|
||
<h3>Create Client<a class="headerlink" href="#create-client" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.insecure_channel">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">insecure_channel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">target</span></em>, <em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#insecure_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.insecure_channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates an insecure Channel to a server.</p>
|
||
<p>The returned Channel is thread-safe.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>target</strong> – The server address</p></li>
|
||
<li><p><strong>options</strong> – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a>
|
||
in gRPC Core runtime) to configure the channel.</p></li>
|
||
<li><p><strong>compression</strong> – An optional value indicating the compression method to be
|
||
used over the lifetime of the channel. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A Channel.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.secure_channel">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">secure_channel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">target</span></em>, <em class="sig-param"><span class="n">credentials</span></em>, <em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#secure_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.secure_channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a secure Channel to a server.</p>
|
||
<p>The returned Channel is thread-safe.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>target</strong> – The server address.</p></li>
|
||
<li><p><strong>credentials</strong> – A ChannelCredentials instance.</p></li>
|
||
<li><p><strong>options</strong> – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a>
|
||
in gRPC Core runtime) to configure the channel.</p></li>
|
||
<li><p><strong>compression</strong> – An optional value indicating the compression method to be
|
||
used over the lifetime of the channel. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A Channel.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.intercept_channel">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">intercept_channel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">interceptors</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#intercept_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.intercept_channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Intercepts a channel through a set of interceptors.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>channel</strong> – A Channel.</p></li>
|
||
<li><p><strong>interceptors</strong> – Zero or more objects of type
|
||
UnaryUnaryClientInterceptor,
|
||
UnaryStreamClientInterceptor,
|
||
StreamUnaryClientInterceptor, or
|
||
StreamStreamClientInterceptor.
|
||
Interceptors are given control in the order they are listed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A Channel that intercepts each invocation via the provided interceptors.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><strong>TypeError</strong> – If interceptor does not derive from any of
|
||
UnaryUnaryClientInterceptor,
|
||
UnaryStreamClientInterceptor,
|
||
StreamUnaryClientInterceptor, or
|
||
StreamStreamClientInterceptor.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="create-client-credentials">
|
||
<h3>Create Client Credentials<a class="headerlink" href="#create-client-credentials" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.ssl_channel_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ssl_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">root_certificates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">private_key</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">certificate_chain</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ssl_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ssl_channel_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a ChannelCredentials for use with an SSL-enabled Channel.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>root_certificates</strong> – The PEM-encoded root certificates as a byte string,
|
||
or None to retrieve them from a default location chosen by gRPC
|
||
runtime.</p></li>
|
||
<li><p><strong>private_key</strong> – The PEM-encoded private key as a byte string, or None if no
|
||
private key should be used.</p></li>
|
||
<li><p><strong>certificate_chain</strong> – The PEM-encoded certificate chain as a byte string
|
||
to use or None if no certificate chain should be used.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A ChannelCredentials for use with an SSL-enabled Channel.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.metadata_call_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">metadata_call_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">metadata_plugin</span></em>, <em class="sig-param"><span class="n">name</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#metadata_call_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.metadata_call_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Construct CallCredentials from an AuthMetadataPlugin.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>metadata_plugin</strong> – An AuthMetadataPlugin to use for authentication.</p></li>
|
||
<li><p><strong>name</strong> – An optional name for the plugin.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A CallCredentials.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.access_token_call_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">access_token_call_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">access_token</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#access_token_call_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.access_token_call_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Construct CallCredentials from an access token.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>access_token</strong> – A string to place directly in the http request
|
||
authorization header, for example
|
||
“authorization: Bearer <access_token>”.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A CallCredentials.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.composite_call_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">composite_call_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">call_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#composite_call_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.composite_call_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Compose multiple CallCredentials to make a new CallCredentials.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>*call_credentials</strong> – At least two CallCredentials objects.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A CallCredentials object composed of the given CallCredentials objects.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.composite_channel_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">composite_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel_credentials</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">call_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#composite_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.composite_channel_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Compose a ChannelCredentials and one or more CallCredentials objects.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>channel_credentials</strong> – A ChannelCredentials object.</p></li>
|
||
<li><p><strong>*call_credentials</strong> – One or more CallCredentials objects.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>A ChannelCredentials composed of the given ChannelCredentials and</dt><dd><p>CallCredentials objects.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.local_channel_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">local_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">local_connect_type</span><span class="o">=</span><span class="default_value">grpc.LocalConnectionType.LOCAL_TCP</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#local_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.local_channel_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a local ChannelCredentials used for local connections.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<p>Local credentials are used by local TCP endpoints (e.g. localhost:10000)
|
||
also UDS connections.</p>
|
||
<p>The connections created by local channel credentials are not
|
||
encrypted, but will be checked if they are local or not.
|
||
The UDS connections are considered secure by providing peer authentication
|
||
and data confidentiality while TCP connections are considered insecure.</p>
|
||
<p>It is allowed to transmit call credentials over connections created by
|
||
local channel credentials.</p>
|
||
<p>Local channel credentials are useful for 1) eliminating insecure_channel usage;
|
||
2) enable unit testing for call credentials without setting up secrets.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>local_connect_type</strong> – Local connection type (either
|
||
grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP)</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A ChannelCredentials for use with a local Channel</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.compute_engine_channel_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">compute_engine_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">call_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#compute_engine_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.compute_engine_channel_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a compute engine channel credential.</p>
|
||
<p>This credential can only be used in a GCP environment as it relies on
|
||
a handshaker service. For more info about ALTS, see
|
||
<a class="reference external" href="https://cloud.google.com/security/encryption-in-transit/application-layer-transport-security">https://cloud.google.com/security/encryption-in-transit/application-layer-transport-security</a></p>
|
||
<p>This channel credential is expected to be used as part of a composite
|
||
credential in conjunction with a call credentials that authenticates the
|
||
VM’s default service account. If used with any other sort of call
|
||
credential, the connection may suddenly and unexpectedly begin failing RPCs.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="create-server">
|
||
<h3>Create Server<a class="headerlink" href="#create-server" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.server">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">server</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">thread_pool</span></em>, <em class="sig-param"><span class="n">handlers</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">interceptors</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">maximum_concurrent_rpcs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#server"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.server" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a Server with which RPCs can be serviced.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>thread_pool</strong> – A futures.ThreadPoolExecutor to be used by the Server
|
||
to execute RPC handlers.</p></li>
|
||
<li><p><strong>handlers</strong> – An optional list of GenericRpcHandlers used for executing RPCs.
|
||
More handlers may be added by calling add_generic_rpc_handlers any time
|
||
before the server is started.</p></li>
|
||
<li><p><strong>interceptors</strong> – An optional list of ServerInterceptor objects that observe
|
||
and optionally manipulate the incoming RPCs before handing them over to
|
||
handlers. The interceptors are given control in the order they are
|
||
specified. This is an EXPERIMENTAL API.</p></li>
|
||
<li><p><strong>options</strong> – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a> in gRPC runtime)
|
||
to configure the channel.</p></li>
|
||
<li><p><strong>maximum_concurrent_rpcs</strong> – The maximum number of concurrent RPCs this server
|
||
will service before returning RESOURCE_EXHAUSTED status, or None to
|
||
indicate no limit.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This compression algorithm will be used for the
|
||
lifetime of the server unless overridden. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A Server object.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="create-server-credentials">
|
||
<h3>Create Server Credentials<a class="headerlink" href="#create-server-credentials" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.ssl_server_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ssl_server_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">private_key_certificate_chain_pairs</span></em>, <em class="sig-param"><span class="n">root_certificates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">require_client_auth</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ssl_server_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ssl_server_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a ServerCredentials for use with an SSL-enabled Server.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>private_key_certificate_chain_pairs</strong> – A list of pairs of the form
|
||
[PEM-encoded private key, PEM-encoded certificate chain].</p></li>
|
||
<li><p><strong>root_certificates</strong> – An optional byte string of PEM-encoded client root
|
||
certificates that the server will use to verify client authentication.
|
||
If omitted, require_client_auth must also be False.</p></li>
|
||
<li><p><strong>require_client_auth</strong> – A boolean indicating whether or not to require
|
||
clients to be authenticated. May only be True if root_certificates
|
||
is not None.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A ServerCredentials for use with an SSL-enabled Server. Typically, this
|
||
object is an argument to add_secure_port() method during server setup.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.ssl_server_certificate_configuration">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ssl_server_certificate_configuration</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">private_key_certificate_chain_pairs</span></em>, <em class="sig-param"><span class="n">root_certificates</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ssl_server_certificate_configuration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ssl_server_certificate_configuration" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a ServerCertificateConfiguration for use with a Server.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>private_key_certificate_chain_pairs</strong> – A collection of pairs of
|
||
the form [PEM-encoded private key, PEM-encoded certificate
|
||
chain].</p></li>
|
||
<li><p><strong>root_certificates</strong> – An optional byte string of PEM-encoded client root
|
||
certificates that the server will use to verify client authentication.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>A ServerCertificateConfiguration that can be returned in the certificate</dt><dd><p>configuration fetching callback.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.dynamic_ssl_server_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">dynamic_ssl_server_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">initial_certificate_configuration</span></em>, <em class="sig-param"><span class="n">certificate_configuration_fetcher</span></em>, <em class="sig-param"><span class="n">require_client_authentication</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#dynamic_ssl_server_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.dynamic_ssl_server_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a ServerCredentials for use with an SSL-enabled Server.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>initial_certificate_configuration</strong> (<a class="reference internal" href="#grpc.ServerCertificateConfiguration" title="grpc.ServerCertificateConfiguration"><em>ServerCertificateConfiguration</em></a>) – The
|
||
certificate configuration with which the server will be initialized.</p></li>
|
||
<li><p><strong>certificate_configuration_fetcher</strong> (<em>callable</em>) – A callable that takes no
|
||
arguments and should return a ServerCertificateConfiguration to
|
||
replace the server’s current certificate, or None for no change
|
||
(i.e., the server will continue its current certificate
|
||
config). The library will call this callback on <em>every</em> new
|
||
client connection before starting the TLS handshake with the
|
||
client, thus allowing the user application to optionally
|
||
return a new ServerCertificateConfiguration that the server will then
|
||
use for the handshake.</p></li>
|
||
<li><p><strong>require_client_authentication</strong> – A boolean indicating whether or not to
|
||
require clients to be authenticated.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A ServerCredentials.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.local_server_credentials">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">local_server_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">local_connect_type</span><span class="o">=</span><span class="default_value">grpc.LocalConnectionType.LOCAL_TCP</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#local_server_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.local_server_credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a local ServerCredentials used for local connections.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<p>Local credentials are used by local TCP endpoints (e.g. localhost:10000)
|
||
also UDS connections.</p>
|
||
<p>The connections created by local server credentials are not
|
||
encrypted, but will be checked if they are local or not.
|
||
The UDS connections are considered secure by providing peer authentication
|
||
and data confidentiality while TCP connections are considered insecure.</p>
|
||
<p>It is allowed to transmit call credentials over connections created by local
|
||
server credentials.</p>
|
||
<p>Local server credentials are useful for 1) eliminating insecure_channel usage;
|
||
2) enable unit testing for call credentials without setting up secrets.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>local_connect_type</strong> – Local connection type (either
|
||
grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP)</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A ServerCredentials for use with a local Server</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="local-connection-type">
|
||
<h3>Local Connection Type<a class="headerlink" href="#local-connection-type" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.LocalConnectionType">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">LocalConnectionType</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#LocalConnectionType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.LocalConnectionType" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Types of local connection for local credential creation.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.LocalConnectionType.UDS">
|
||
<code class="sig-name descname">UDS</code><a class="headerlink" href="#grpc.LocalConnectionType.UDS" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Unix domain socket connections</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.LocalConnectionType.LOCAL_TCP">
|
||
<code class="sig-name descname">LOCAL_TCP</code><a class="headerlink" href="#grpc.LocalConnectionType.LOCAL_TCP" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Local TCP connections.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="rpc-method-handlers">
|
||
<h3>RPC Method Handlers<a class="headerlink" href="#rpc-method-handlers" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.unary_unary_rpc_method_handler">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">unary_unary_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#unary_unary_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.unary_unary_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates an RpcMethodHandler for a unary-unary RPC method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>behavior</strong> – The implementation of an RPC that accepts one request
|
||
and returns one response.</p></li>
|
||
<li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
|
||
<li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.unary_stream_rpc_method_handler">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">unary_stream_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#unary_stream_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.unary_stream_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates an RpcMethodHandler for a unary-stream RPC method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>behavior</strong> – The implementation of an RPC that accepts one request
|
||
and returns an iterator of response values.</p></li>
|
||
<li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
|
||
<li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.stream_unary_rpc_method_handler">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">stream_unary_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#stream_unary_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.stream_unary_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates an RpcMethodHandler for a stream-unary RPC method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>behavior</strong> – The implementation of an RPC that accepts an iterator of
|
||
request values and returns a single response value.</p></li>
|
||
<li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
|
||
<li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.stream_stream_rpc_method_handler">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">stream_stream_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#stream_stream_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.stream_stream_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates an RpcMethodHandler for a stream-stream RPC method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>behavior</strong> – The implementation of an RPC that accepts an iterator of
|
||
request values and returns an iterator of response values.</p></li>
|
||
<li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
|
||
<li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.method_handlers_generic_handler">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">method_handlers_generic_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">service</span></em>, <em class="sig-param"><span class="n">method_handlers</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#method_handlers_generic_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.method_handlers_generic_handler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a GenericRpcHandler from RpcMethodHandlers.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>service</strong> – The name of the service that is implemented by the
|
||
method_handlers.</p></li>
|
||
<li><p><strong>method_handlers</strong> – A dictionary that maps method names to corresponding
|
||
RpcMethodHandler.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A GenericRpcHandler. This is typically added to the grpc.Server object
|
||
with add_generic_rpc_handlers() before starting the server.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="channel-ready-future">
|
||
<h3>Channel Ready Future<a class="headerlink" href="#channel-ready-future" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.channel_ready_future">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">channel_ready_future</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#channel_ready_future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.channel_ready_future" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a Future that tracks when a Channel is ready.</p>
|
||
<p>Cancelling the Future does not affect the channel’s state machine.
|
||
It merely decouples the Future from channel state machine.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>channel</strong> – A Channel object.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A Future object that matures when the channel connectivity is
|
||
ChannelConnectivity.READY.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="channel-connectivity">
|
||
<h3>Channel Connectivity<a class="headerlink" href="#channel-connectivity" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.ChannelConnectivity">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ChannelConnectivity</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ChannelConnectivity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ChannelConnectivity" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Mirrors grpc_connectivity_state in the gRPC Core.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ChannelConnectivity.IDLE">
|
||
<code class="sig-name descname">IDLE</code><a class="headerlink" href="#grpc.ChannelConnectivity.IDLE" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel is idle.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ChannelConnectivity.CONNECTING">
|
||
<code class="sig-name descname">CONNECTING</code><a class="headerlink" href="#grpc.ChannelConnectivity.CONNECTING" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel is connecting.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ChannelConnectivity.READY">
|
||
<code class="sig-name descname">READY</code><a class="headerlink" href="#grpc.ChannelConnectivity.READY" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel is ready to conduct RPCs.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ChannelConnectivity.TRANSIENT_FAILURE">
|
||
<code class="sig-name descname">TRANSIENT_FAILURE</code><a class="headerlink" href="#grpc.ChannelConnectivity.TRANSIENT_FAILURE" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel has seen a failure from which it expects
|
||
to recover.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ChannelConnectivity.SHUTDOWN">
|
||
<code class="sig-name descname">SHUTDOWN</code><a class="headerlink" href="#grpc.ChannelConnectivity.SHUTDOWN" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The channel has seen a failure from which it cannot recover.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="grpc-status-code">
|
||
<h3>gRPC Status Code<a class="headerlink" href="#grpc-status-code" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.StatusCode">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StatusCode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StatusCode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StatusCode" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Mirrors grpc_status_code in the gRPC Core.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.OK">
|
||
<code class="sig-name descname">OK</code><a class="headerlink" href="#grpc.StatusCode.OK" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Not an error; returned on success</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.CANCELLED">
|
||
<code class="sig-name descname">CANCELLED</code><a class="headerlink" href="#grpc.StatusCode.CANCELLED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The operation was cancelled (typically by the caller).</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.UNKNOWN">
|
||
<code class="sig-name descname">UNKNOWN</code><a class="headerlink" href="#grpc.StatusCode.UNKNOWN" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Unknown error.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.INVALID_ARGUMENT">
|
||
<code class="sig-name descname">INVALID_ARGUMENT</code><a class="headerlink" href="#grpc.StatusCode.INVALID_ARGUMENT" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Client specified an invalid argument.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.DEADLINE_EXCEEDED">
|
||
<code class="sig-name descname">DEADLINE_EXCEEDED</code><a class="headerlink" href="#grpc.StatusCode.DEADLINE_EXCEEDED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Deadline expired before operation could complete.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.NOT_FOUND">
|
||
<code class="sig-name descname">NOT_FOUND</code><a class="headerlink" href="#grpc.StatusCode.NOT_FOUND" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Some requested entity (e.g., file or directory) was not found.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.ALREADY_EXISTS">
|
||
<code class="sig-name descname">ALREADY_EXISTS</code><a class="headerlink" href="#grpc.StatusCode.ALREADY_EXISTS" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Some entity that we attempted to create (e.g., file or directory)
|
||
already exists.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.PERMISSION_DENIED">
|
||
<code class="sig-name descname">PERMISSION_DENIED</code><a class="headerlink" href="#grpc.StatusCode.PERMISSION_DENIED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The caller does not have permission to execute the specified
|
||
operation.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.UNAUTHENTICATED">
|
||
<code class="sig-name descname">UNAUTHENTICATED</code><a class="headerlink" href="#grpc.StatusCode.UNAUTHENTICATED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The request does not have valid authentication credentials for the
|
||
operation.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.RESOURCE_EXHAUSTED">
|
||
<code class="sig-name descname">RESOURCE_EXHAUSTED</code><a class="headerlink" href="#grpc.StatusCode.RESOURCE_EXHAUSTED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Some resource has been exhausted, perhaps a per-user quota, or
|
||
perhaps the entire file system is out of space.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.FAILED_PRECONDITION">
|
||
<code class="sig-name descname">FAILED_PRECONDITION</code><a class="headerlink" href="#grpc.StatusCode.FAILED_PRECONDITION" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Operation was rejected because the system is not in a state
|
||
required for the operation’s execution.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.ABORTED">
|
||
<code class="sig-name descname">ABORTED</code><a class="headerlink" href="#grpc.StatusCode.ABORTED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The operation was aborted, typically due to a concurrency issue
|
||
like sequencer check failures, transaction aborts, etc.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.UNIMPLEMENTED">
|
||
<code class="sig-name descname">UNIMPLEMENTED</code><a class="headerlink" href="#grpc.StatusCode.UNIMPLEMENTED" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Operation is not implemented or not supported/enabled in this service.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.INTERNAL">
|
||
<code class="sig-name descname">INTERNAL</code><a class="headerlink" href="#grpc.StatusCode.INTERNAL" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Internal errors. Means some invariants expected by underlying
|
||
system has been broken.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.UNAVAILABLE">
|
||
<code class="sig-name descname">UNAVAILABLE</code><a class="headerlink" href="#grpc.StatusCode.UNAVAILABLE" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The service is currently unavailable.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.StatusCode.DATA_LOSS">
|
||
<code class="sig-name descname">DATA_LOSS</code><a class="headerlink" href="#grpc.StatusCode.DATA_LOSS" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Unrecoverable data loss or corruption.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="channel-object">
|
||
<h3>Channel Object<a class="headerlink" href="#channel-object" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.Channel">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Channel</code><a class="reference internal" href="_modules/grpc.html#Channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords RPC invocation via generic methods on client-side.</p>
|
||
<p>Channel objects implement the Context Manager type, although they need not
|
||
support being entered and exited multiple times.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.__enter__">
|
||
<code class="sig-name descname">__enter__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.__enter__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.__enter__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Enters the runtime context related to the channel object.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.__exit__">
|
||
<code class="sig-name descname">__exit__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">exc_type</span></em>, <em class="sig-param"><span class="n">exc_val</span></em>, <em class="sig-param"><span class="n">exc_tb</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.__exit__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.__exit__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Exits the runtime context related to the channel object.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.close">
|
||
<em class="property">abstract </em><code class="sig-name descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.close"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.close" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Closes this Channel and releases all resources held by it.</p>
|
||
<p>Closing the Channel will immediately terminate all RPCs active with the
|
||
Channel and it is not valid to invoke new RPCs with the Channel.</p>
|
||
<p>This method is idempotent.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.stream_stream">
|
||
<em class="property">abstract </em><code class="sig-name descname">stream_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.stream_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.stream_stream" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a StreamStreamMultiCallable for a stream-stream method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>method</strong> – The name of the RPC method.</p></li>
|
||
<li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
|
||
message. Request goes unserialized in case None is passed.</p></li>
|
||
<li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
|
||
response message. Response goes undeserialized in case None
|
||
is passed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A StreamStreamMultiCallable value for the named stream-stream method.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.stream_unary">
|
||
<em class="property">abstract </em><code class="sig-name descname">stream_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.stream_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.stream_unary" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a StreamUnaryMultiCallable for a stream-unary method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>method</strong> – The name of the RPC method.</p></li>
|
||
<li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
|
||
message. Request goes unserialized in case None is passed.</p></li>
|
||
<li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
|
||
response message. Response goes undeserialized in case None is
|
||
passed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A StreamUnaryMultiCallable value for the named stream-unary method.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.subscribe">
|
||
<em class="property">abstract </em><code class="sig-name descname">subscribe</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em>, <em class="sig-param"><span class="n">try_to_connect</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.subscribe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.subscribe" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Subscribe to this Channel’s connectivity state machine.</p>
|
||
<p>A Channel may be in any of the states described by ChannelConnectivity.
|
||
This method allows application to monitor the state transitions.
|
||
The typical use case is to debug or gain better visibility into gRPC
|
||
runtime’s state.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>callback</strong> – A callable to be invoked with ChannelConnectivity argument.
|
||
ChannelConnectivity describes current state of the channel.
|
||
The callable will be invoked immediately upon subscription
|
||
and again for every change to ChannelConnectivity until it
|
||
is unsubscribed or this Channel object goes out of scope.</p></li>
|
||
<li><p><strong>try_to_connect</strong> – A boolean indicating whether or not this Channel
|
||
should attempt to connect immediately. If set to False, gRPC
|
||
runtime decides when to connect.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.unary_stream">
|
||
<em class="property">abstract </em><code class="sig-name descname">unary_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.unary_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.unary_stream" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a UnaryStreamMultiCallable for a unary-stream method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>method</strong> – The name of the RPC method.</p></li>
|
||
<li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
|
||
message. Request goes unserialized in case None is passed.</p></li>
|
||
<li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
|
||
response message. Response goes undeserialized in case None is
|
||
passed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A UnaryStreamMultiCallable value for the name unary-stream method.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.unary_unary">
|
||
<em class="property">abstract </em><code class="sig-name descname">unary_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.unary_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.unary_unary" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Creates a UnaryUnaryMultiCallable for a unary-unary method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>method</strong> – The name of the RPC method.</p></li>
|
||
<li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
|
||
message. Request goes unserialized in case None is passed.</p></li>
|
||
<li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
|
||
response message. Response goes undeserialized in case None
|
||
is passed.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A UnaryUnaryMultiCallable value for the named unary-unary method.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Channel.unsubscribe">
|
||
<em class="property">abstract </em><code class="sig-name descname">unsubscribe</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.unsubscribe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.unsubscribe" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Unsubscribes a subscribed callback from this Channel’s connectivity.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>callback</strong> – A callable previously registered with this Channel from</p></li>
|
||
<li><p><strong>been passed to its "subscribe" method.</strong> (<em>having</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="server-object">
|
||
<h3>Server Object<a class="headerlink" href="#server-object" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.Server">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Server</code><a class="reference internal" href="_modules/grpc.html#Server"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Services RPCs.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.Server.add_generic_rpc_handlers">
|
||
<em class="property">abstract </em><code class="sig-name descname">add_generic_rpc_handlers</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">generic_rpc_handlers</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.add_generic_rpc_handlers"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.add_generic_rpc_handlers" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Registers GenericRpcHandlers with this Server.</p>
|
||
<p>This method is only safe to call before the server is started.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>generic_rpc_handlers</strong> – An iterable of GenericRpcHandlers that will be</p></li>
|
||
<li><p><strong>to service RPCs.</strong> (<em>used</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Server.add_insecure_port">
|
||
<em class="property">abstract </em><code class="sig-name descname">add_insecure_port</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">address</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.add_insecure_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.add_insecure_port" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Opens an insecure port for accepting RPCs.</p>
|
||
<p>This method may only be called before starting the server.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>address</strong> – The address for which to open a port. If the port is 0,
|
||
or not specified in the address, then gRPC runtime will choose a port.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An integer port on which server will accept RPC requests.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Server.add_secure_port">
|
||
<em class="property">abstract </em><code class="sig-name descname">add_secure_port</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">address</span></em>, <em class="sig-param"><span class="n">server_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.add_secure_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.add_secure_port" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Opens a secure port for accepting RPCs.</p>
|
||
<p>This method may only be called before starting the server.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>address</strong> – The address for which to open a port.
|
||
if the port is 0, or not specified in the address, then gRPC
|
||
runtime will choose a port.</p></li>
|
||
<li><p><strong>server_credentials</strong> – A ServerCredentials object.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An integer port on which server will accept RPC requests.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Server.start">
|
||
<em class="property">abstract </em><code class="sig-name descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.start" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Starts this Server.</p>
|
||
<p>This method may only be called once. (i.e. it is not idempotent).</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Server.stop">
|
||
<em class="property">abstract </em><code class="sig-name descname">stop</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">grace</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.stop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.stop" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Stops this Server.</p>
|
||
<p>This method immediately stop service of new RPCs in all cases.</p>
|
||
<p>If a grace period is specified, this method returns immediately
|
||
and all RPCs active at the end of the grace period are aborted.
|
||
If a grace period is not specified (by passing None for <cite>grace</cite>),
|
||
all existing RPCs are aborted immediately and this method
|
||
blocks until the last RPC handler terminates.</p>
|
||
<p>This method is idempotent and may be called at any time.
|
||
Passing a smaller grace value in a subsequent call will have
|
||
the effect of stopping the Server sooner (passing None will
|
||
have the effect of stopping the server immediately). Passing
|
||
a larger grace value in a subsequent call <em>will not</em> have the
|
||
effect of stopping the server later (i.e. the most restrictive
|
||
grace value is used).</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>grace</strong> – A duration of time in seconds or None.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A threading.Event that will be set when this Server has completely
|
||
stopped, i.e. when running RPCs either complete or are aborted and
|
||
all handlers have terminated.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Server.wait_for_termination">
|
||
<code class="sig-name descname">wait_for_termination</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.wait_for_termination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.wait_for_termination" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Block current thread until the server stops.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<p>The wait will not consume computational resources during blocking, and
|
||
it will block until one of the two following conditions are met:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>The server is stopped or terminated;</p></li>
|
||
<li><p>A timeout occurs if timeout is not <cite>None</cite>.</p></li>
|
||
</ol>
|
||
<p>The timeout argument works in the same way as <cite>threading.Event.wait()</cite>.
|
||
<a class="reference external" href="https://docs.python.org/3/library/threading.html#threading.Event.wait">https://docs.python.org/3/library/threading.html#threading.Event.wait</a></p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>timeout</strong> – A floating point number specifying a timeout for the
|
||
operation in seconds.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A bool indicates if the operation times out.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="authentication-authorization-objects">
|
||
<h3>Authentication & Authorization Objects<a class="headerlink" href="#authentication-authorization-objects" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.ChannelCredentials">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ChannelCredentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ChannelCredentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ChannelCredentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An encapsulation of the data required to create a secure Channel.</p>
|
||
<p>This class has no supported interface - it exists to define the type of its
|
||
instances and its instances exist to be passed to other functions. For
|
||
example, ssl_channel_credentials returns an instance of this class and
|
||
secure_channel requires an instance of this class.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.CallCredentials">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">CallCredentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#CallCredentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.CallCredentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An encapsulation of the data required to assert an identity over a call.</p>
|
||
<p>A CallCredentials has to be used with secure Channel, otherwise the
|
||
metadata will not be transmitted to the server.</p>
|
||
<p>A CallCredentials may be composed with ChannelCredentials to always assert
|
||
identity for every call over that Channel.</p>
|
||
<p>This class has no supported interface - it exists to define the type of its
|
||
instances and its instances exist to be passed to other functions.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.AuthMetadataContext">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">AuthMetadataContext</code><a class="reference internal" href="_modules/grpc.html#AuthMetadataContext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataContext" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Provides information to call credentials metadata plugins.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.AuthMetadataContext.service_url">
|
||
<code class="sig-name descname">service_url</code><a class="headerlink" href="#grpc.AuthMetadataContext.service_url" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A string URL of the service being called into.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.AuthMetadataContext.method_name">
|
||
<code class="sig-name descname">method_name</code><a class="headerlink" href="#grpc.AuthMetadataContext.method_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A string of the fully qualified method name being called.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.AuthMetadataPluginCallback">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">AuthMetadataPluginCallback</code><a class="reference internal" href="_modules/grpc.html#AuthMetadataPluginCallback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPluginCallback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Callback object received by a metadata plugin.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.AuthMetadataPluginCallback.__call__">
|
||
<code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">metadata</span></em>, <em class="sig-param"><span class="n">error</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#AuthMetadataPluginCallback.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPluginCallback.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Passes to the gRPC runtime authentication metadata for an RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>metadata</strong> – The <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> used to construct the CallCredentials.</p></li>
|
||
<li><p><strong>error</strong> – An Exception to indicate error or None to indicate success.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.AuthMetadataPlugin">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">AuthMetadataPlugin</code><a class="reference internal" href="_modules/grpc.html#AuthMetadataPlugin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPlugin" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A specification for custom authentication.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.AuthMetadataPlugin.__call__">
|
||
<code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">context</span></em>, <em class="sig-param"><span class="n">callback</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#AuthMetadataPlugin.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPlugin.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Implements authentication by passing metadata to a callback.</p>
|
||
<p>This method will be invoked asynchronously in a separate thread.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>context</strong> – An AuthMetadataContext providing information on the RPC that
|
||
the plugin is being called to authenticate.</p></li>
|
||
<li><p><strong>callback</strong> – An AuthMetadataPluginCallback to be invoked either
|
||
synchronously or asynchronously.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.ServerCredentials">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServerCredentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServerCredentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerCredentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An encapsulation of the data required to open a secure port on a Server.</p>
|
||
<p>This class has no supported interface - it exists to define the type of its
|
||
instances and its instances exist to be passed to other functions.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.ServerCertificateConfiguration">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServerCertificateConfiguration</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">certificate_configuration</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServerCertificateConfiguration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerCertificateConfiguration" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A certificate configuration for use with an SSL-enabled Server.</p>
|
||
<p>Instances of this class can be returned in the certificate configuration
|
||
fetching callback.</p>
|
||
<p>This class has no supported interface – it exists to define the
|
||
type of its instances and its instances exist to be passed to
|
||
other functions.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="grpc-exceptions">
|
||
<h3>gRPC Exceptions<a class="headerlink" href="#grpc-exceptions" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py exception">
|
||
<dt id="grpc.RpcError">
|
||
<em class="property">exception </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">RpcError</code><a class="reference internal" href="_modules/grpc.html#RpcError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Raised by the gRPC library to indicate non-OK-status RPC termination.</p>
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="shared-context">
|
||
<h3>Shared Context<a class="headerlink" href="#shared-context" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.RpcContext">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">RpcContext</code><a class="reference internal" href="_modules/grpc.html#RpcContext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Provides RPC-related information and action.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.RpcContext.add_callback">
|
||
<em class="property">abstract </em><code class="sig-name descname">add_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.add_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.add_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Registers a callback to be called on RPC termination.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>callback</strong> – A no-parameter callable to be called on RPC termination.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><dl class="simple">
|
||
<dt>True if the callback was added and will be called later; False if</dt><dd><p>the callback was not added and will not be called (because the RPC
|
||
already terminated or some other reason).</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.RpcContext.cancel">
|
||
<em class="property">abstract </em><code class="sig-name descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.cancel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Cancels the RPC.</p>
|
||
<p>Idempotent and has no effect if the RPC has already terminated.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.RpcContext.is_active">
|
||
<em class="property">abstract </em><code class="sig-name descname">is_active</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.is_active"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.is_active" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes whether the RPC is active or has terminated.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>True if RPC is active, False otherwise.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>bool</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.RpcContext.time_remaining">
|
||
<em class="property">abstract </em><code class="sig-name descname">time_remaining</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.time_remaining"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.time_remaining" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes the length of allowed time remaining for the RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A nonnegative float indicating the length of allowed time in seconds
|
||
remaining for the RPC to complete before it is considered to have
|
||
timed out, or None if no deadline was specified for the RPC.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="client-side-context">
|
||
<h3>Client-Side Context<a class="headerlink" href="#client-side-context" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.Call">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Call</code><a class="reference internal" href="_modules/grpc.html#Call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Invocation-side utility object for an RPC.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.Call.code">
|
||
<em class="property">abstract </em><code class="sig-name descname">code</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.code" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Accesses the status code sent by the server.</p>
|
||
<p>This method blocks until the value is available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The StatusCode value for the RPC.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Call.details">
|
||
<em class="property">abstract </em><code class="sig-name descname">details</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.details"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.details" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Accesses the details sent by the server.</p>
|
||
<p>This method blocks until the value is available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The details string of the RPC.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Call.initial_metadata">
|
||
<em class="property">abstract </em><code class="sig-name descname">initial_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.initial_metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Accesses the initial metadata sent by the server.</p>
|
||
<p>This method blocks until the value is available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Call.trailing_metadata">
|
||
<em class="property">abstract </em><code class="sig-name descname">trailing_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.trailing_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.trailing_metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Accesses the trailing metadata sent by the server.</p>
|
||
<p>This method blocks until the value is available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="client-side-interceptor">
|
||
<h3>Client-Side Interceptor<a class="headerlink" href="#client-side-interceptor" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.ClientCallDetails">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ClientCallDetails</code><a class="reference internal" href="_modules/grpc.html#ClientCallDetails"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ClientCallDetails" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes an RPC to be invoked.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ClientCallDetails.method">
|
||
<code class="sig-name descname">method</code><a class="headerlink" href="#grpc.ClientCallDetails.method" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The method name of the RPC.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ClientCallDetails.timeout">
|
||
<code class="sig-name descname">timeout</code><a class="headerlink" href="#grpc.ClientCallDetails.timeout" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An optional duration of time in seconds to allow for the RPC.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ClientCallDetails.metadata">
|
||
<code class="sig-name descname">metadata</code><a class="headerlink" href="#grpc.ClientCallDetails.metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to
|
||
the service-side of the RPC.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ClientCallDetails.credentials">
|
||
<code class="sig-name descname">credentials</code><a class="headerlink" href="#grpc.ClientCallDetails.credentials" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An optional CallCredentials for the RPC.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ClientCallDetails.wait_for_ready">
|
||
<code class="sig-name descname">wait_for_ready</code><a class="headerlink" href="#grpc.ClientCallDetails.wait_for_ready" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.ClientCallDetails.compression">
|
||
<code class="sig-name descname">compression</code><a class="headerlink" href="#grpc.ClientCallDetails.compression" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.UnaryUnaryClientInterceptor">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryUnaryClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#UnaryUnaryClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryClientInterceptor" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords intercepting unary-unary invocations.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.UnaryUnaryClientInterceptor.intercept_unary_unary">
|
||
<em class="property">abstract </em><code class="sig-name descname">intercept_unary_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryClientInterceptor.intercept_unary_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryClientInterceptor.intercept_unary_unary" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Intercepts a unary-unary invocation asynchronously.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>continuation</strong> – A function that proceeds with the invocation by
|
||
executing the next interceptor in chain or invoking the
|
||
actual RPC on the underlying Channel. It is the interceptor’s
|
||
responsibility to call it if it decides to move the RPC forward.
|
||
The interceptor can use
|
||
<cite>response_future = continuation(client_call_details, request)</cite>
|
||
to continue with the RPC. <cite>continuation</cite> returns an object that is
|
||
both a Call for the RPC and a Future. In the event of RPC
|
||
completion, the return Call-Future’s result value will be
|
||
the response message of the RPC. Should the event terminate
|
||
with non-OK status, the returned Call-Future’s exception value
|
||
will be an RpcError.</p></li>
|
||
<li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
|
||
outgoing RPC.</p></li>
|
||
<li><p><strong>request</strong> – The request value for the RPC.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
|
||
In the event of RPC completion, the return Call-Future’s
|
||
result value will be the response message of the RPC.
|
||
Should the event terminate with non-OK status, the returned
|
||
Call-Future’s exception value will be an RpcError.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.UnaryStreamClientInterceptor">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryStreamClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#UnaryStreamClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamClientInterceptor" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords intercepting unary-stream invocations.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.UnaryStreamClientInterceptor.intercept_unary_stream">
|
||
<em class="property">abstract </em><code class="sig-name descname">intercept_unary_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryStreamClientInterceptor.intercept_unary_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamClientInterceptor.intercept_unary_stream" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Intercepts a unary-stream invocation.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>continuation</strong> – A function that proceeds with the invocation by
|
||
executing the next interceptor in chain or invoking the
|
||
actual RPC on the underlying Channel. It is the interceptor’s
|
||
responsibility to call it if it decides to move the RPC forward.
|
||
The interceptor can use
|
||
<cite>response_iterator = continuation(client_call_details, request)</cite>
|
||
to continue with the RPC. <cite>continuation</cite> returns an object that is
|
||
both a Call for the RPC and an iterator for response values.
|
||
Drawing response values from the returned Call-iterator may
|
||
raise RpcError indicating termination of the RPC with non-OK
|
||
status.</p></li>
|
||
<li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
|
||
outgoing RPC.</p></li>
|
||
<li><p><strong>request</strong> – The request value for the RPC.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
|
||
response values. Drawing response values from the returned
|
||
Call-iterator may raise RpcError indicating termination of
|
||
the RPC with non-OK status.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.StreamUnaryClientInterceptor">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamUnaryClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#StreamUnaryClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryClientInterceptor" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords intercepting stream-unary invocations.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.StreamUnaryClientInterceptor.intercept_stream_unary">
|
||
<em class="property">abstract </em><code class="sig-name descname">intercept_stream_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request_iterator</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryClientInterceptor.intercept_stream_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryClientInterceptor.intercept_stream_unary" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Intercepts a stream-unary invocation asynchronously.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>continuation</strong> – A function that proceeds with the invocation by
|
||
executing the next interceptor in chain or invoking the
|
||
actual RPC on the underlying Channel. It is the interceptor’s
|
||
responsibility to call it if it decides to move the RPC forward.
|
||
The interceptor can use
|
||
<cite>response_future = continuation(client_call_details, request_iterator)</cite>
|
||
to continue with the RPC. <cite>continuation</cite> returns an object that is
|
||
both a Call for the RPC and a Future. In the event of RPC completion,
|
||
the return Call-Future’s result value will be the response message
|
||
of the RPC. Should the event terminate with non-OK status, the
|
||
returned Call-Future’s exception value will be an RpcError.</p></li>
|
||
<li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
|
||
outgoing RPC.</p></li>
|
||
<li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
|
||
In the event of RPC completion, the return Call-Future’s
|
||
result value will be the response message of the RPC.
|
||
Should the event terminate with non-OK status, the returned
|
||
Call-Future’s exception value will be an RpcError.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.StreamStreamClientInterceptor">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamStreamClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#StreamStreamClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamClientInterceptor" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords intercepting stream-stream invocations.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.StreamStreamClientInterceptor.intercept_stream_stream">
|
||
<em class="property">abstract </em><code class="sig-name descname">intercept_stream_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request_iterator</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamStreamClientInterceptor.intercept_stream_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamClientInterceptor.intercept_stream_stream" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Intercepts a stream-stream invocation.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>continuation</strong> – A function that proceeds with the invocation by
|
||
executing the next interceptor in chain or invoking the
|
||
actual RPC on the underlying Channel. It is the interceptor’s
|
||
responsibility to call it if it decides to move the RPC forward.
|
||
The interceptor can use
|
||
<cite>response_iterator = continuation(client_call_details, request_iterator)</cite>
|
||
to continue with the RPC. <cite>continuation</cite> returns an object that is
|
||
both a Call for the RPC and an iterator for response values.
|
||
Drawing response values from the returned Call-iterator may
|
||
raise RpcError indicating termination of the RPC with non-OK
|
||
status.</p></li>
|
||
<li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
|
||
outgoing RPC.</p></li>
|
||
<li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
|
||
response values. Drawing response values from the returned
|
||
Call-iterator may raise RpcError indicating termination of
|
||
the RPC with non-OK status.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="service-side-context">
|
||
<h3>Service-Side Context<a class="headerlink" href="#service-side-context" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.ServicerContext">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServicerContext</code><a class="reference internal" href="_modules/grpc.html#ServicerContext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A context object passed to method implementations.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.abort">
|
||
<em class="property">abstract </em><code class="sig-name descname">abort</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">code</span></em>, <em class="sig-param"><span class="n">details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.abort"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.abort" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Raises an exception to terminate the RPC with a non-OK status.</p>
|
||
<p>The code and details passed as arguments will supercede any existing
|
||
ones.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>code</strong> – A StatusCode object to be sent to the client.
|
||
It must not be StatusCode.OK.</p></li>
|
||
<li><p><strong>details</strong> – A UTF-8-encodable string to be sent to the client upon
|
||
termination of the RPC.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><strong>Exception</strong> – An exception is always raised to signal the abortion the
|
||
RPC to the gRPC runtime.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.abort_with_status">
|
||
<em class="property">abstract </em><code class="sig-name descname">abort_with_status</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">status</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.abort_with_status"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.abort_with_status" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Raises an exception to terminate the RPC with a non-OK status.</p>
|
||
<p>The status passed as argument will supercede any existing status code,
|
||
status message and trailing metadata.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>status</strong> – A grpc.Status object. The status code in it must not be
|
||
StatusCode.OK.</p>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><strong>Exception</strong> – An exception is always raised to signal the abortion the
|
||
RPC to the gRPC runtime.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.auth_context">
|
||
<em class="property">abstract </em><code class="sig-name descname">auth_context</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.auth_context"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.auth_context" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Gets the auth context for the call.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A map of strings to an iterable of bytes for each auth property.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.disable_next_message_compression">
|
||
<code class="sig-name descname">disable_next_message_compression</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.disable_next_message_compression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.disable_next_message_compression" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Disables compression for the next response message.</p>
|
||
<p>This is an EXPERIMENTAL method.</p>
|
||
<p>This method will override any compression configuration set during
|
||
server creation or set on the call.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.invocation_metadata">
|
||
<em class="property">abstract </em><code class="sig-name descname">invocation_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.invocation_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.invocation_metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Accesses the metadata from the sent by the client.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The invocation <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.peer">
|
||
<em class="property">abstract </em><code class="sig-name descname">peer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.peer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.peer" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Identifies the peer that invoked the RPC being serviced.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>A string identifying the peer that invoked the RPC being serviced.
|
||
The string format is determined by gRPC runtime.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.peer_identities">
|
||
<em class="property">abstract </em><code class="sig-name descname">peer_identities</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.peer_identities"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.peer_identities" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Gets one or more peer identity(s).</p>
|
||
<p>Equivalent to
|
||
servicer_context.auth_context().get(servicer_context.peer_identity_key())</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>An iterable of the identities, or None if the call is not
|
||
authenticated. Each identity is returned as a raw bytes type.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.peer_identity_key">
|
||
<em class="property">abstract </em><code class="sig-name descname">peer_identity_key</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.peer_identity_key"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.peer_identity_key" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The auth property used to identify the peer.</p>
|
||
<p>For example, “x509_common_name” or “x509_subject_alternative_name” are
|
||
used to identify an SSL peer.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The auth property (string) that indicates the
|
||
peer identity, or None if the call is not authenticated.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.send_initial_metadata">
|
||
<em class="property">abstract </em><code class="sig-name descname">send_initial_metadata</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">initial_metadata</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.send_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Sends the initial metadata value to the client.</p>
|
||
<p>This method need not be called by implementations if they have no
|
||
metadata to add to what the gRPC runtime will transmit.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>initial_metadata</strong> – The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.set_code">
|
||
<em class="property">abstract </em><code class="sig-name descname">set_code</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">code</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_code" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Sets the value to be used as status code upon RPC completion.</p>
|
||
<p>This method need not be called by method implementations if they wish
|
||
the gRPC runtime to determine the status code of the RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>code</strong> – A StatusCode object to be sent to the client.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.set_compression">
|
||
<code class="sig-name descname">set_compression</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">compression</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_compression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_compression" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Set the compression algorithm to be used for the entire call.</p>
|
||
<p>This is an EXPERIMENTAL method.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.set_details">
|
||
<em class="property">abstract </em><code class="sig-name descname">set_details</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_details"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_details" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Sets the value to be used as detail string upon RPC completion.</p>
|
||
<p>This method need not be called by method implementations if they have
|
||
no details to transmit.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>details</strong> – A UTF-8-encodable string to be sent to the client upon
|
||
termination of the RPC.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.ServicerContext.set_trailing_metadata">
|
||
<em class="property">abstract </em><code class="sig-name descname">set_trailing_metadata</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">trailing_metadata</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_trailing_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_trailing_metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Sets the trailing metadata for the RPC.</p>
|
||
<p>Sets the trailing metadata to be sent upon completion of the RPC.</p>
|
||
<p>If this method is invoked multiple times throughout the lifetime of an
|
||
RPC, the value supplied in the final invocation will be the value sent
|
||
over the wire.</p>
|
||
<p>This method need not be called by implementations if they have no
|
||
metadata to add to what the gRPC runtime will transmit.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>trailing_metadata</strong> – The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="service-side-handler">
|
||
<h3>Service-Side Handler<a class="headerlink" href="#service-side-handler" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.RpcMethodHandler">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">RpcMethodHandler</code><a class="reference internal" href="_modules/grpc.html#RpcMethodHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcMethodHandler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An implementation of a single RPC method.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.request_streaming">
|
||
<code class="sig-name descname">request_streaming</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_streaming" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether the RPC supports exactly one request message
|
||
or any arbitrary number of request messages.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.response_streaming">
|
||
<code class="sig-name descname">response_streaming</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_streaming" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Whether the RPC supports exactly one response message
|
||
or any arbitrary number of response messages.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.request_deserializer">
|
||
<code class="sig-name descname">request_deserializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_deserializer" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A callable <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> that accepts a byte string and
|
||
returns an object suitable to be passed to this object’s business
|
||
logic, or None to indicate that this object’s business logic should be
|
||
passed the raw request bytes.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.response_serializer">
|
||
<code class="sig-name descname">response_serializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_serializer" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A callable <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> that accepts an object produced
|
||
by this object’s business logic and returns a byte string, or None to
|
||
indicate that the byte strings produced by this object’s business logic
|
||
should be transmitted on the wire as they are.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.unary_unary">
|
||
<code class="sig-name descname">unary_unary</code><a class="headerlink" href="#grpc.RpcMethodHandler.unary_unary" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This object’s application-specific business logic as a
|
||
callable value that takes a request value and a ServicerContext object
|
||
and returns a response value. Only non-None if both request_streaming
|
||
and response_streaming are False.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.unary_stream">
|
||
<code class="sig-name descname">unary_stream</code><a class="headerlink" href="#grpc.RpcMethodHandler.unary_stream" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This object’s application-specific business logic as a
|
||
callable value that takes a request value and a ServicerContext object
|
||
and returns an iterator of response values. Only non-None if
|
||
request_streaming is False and response_streaming is True.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.stream_unary">
|
||
<code class="sig-name descname">stream_unary</code><a class="headerlink" href="#grpc.RpcMethodHandler.stream_unary" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This object’s application-specific business logic as a
|
||
callable value that takes an iterator of request values and a
|
||
ServicerContext object and returns a response value. Only non-None if
|
||
request_streaming is True and response_streaming is False.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.RpcMethodHandler.stream_stream">
|
||
<code class="sig-name descname">stream_stream</code><a class="headerlink" href="#grpc.RpcMethodHandler.stream_stream" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>This object’s application-specific business logic as a
|
||
callable value that takes an iterator of request values and a
|
||
ServicerContext object and returns an iterator of response values.
|
||
Only non-None if request_streaming and response_streaming are both
|
||
True.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.HandlerCallDetails">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">HandlerCallDetails</code><a class="reference internal" href="_modules/grpc.html#HandlerCallDetails"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.HandlerCallDetails" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes an RPC that has just arrived for service.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.HandlerCallDetails.method">
|
||
<code class="sig-name descname">method</code><a class="headerlink" href="#grpc.HandlerCallDetails.method" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The method name of the RPC.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.HandlerCallDetails.invocation_metadata">
|
||
<code class="sig-name descname">invocation_metadata</code><a class="headerlink" href="#grpc.HandlerCallDetails.invocation_metadata" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> sent by the client.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.GenericRpcHandler">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">GenericRpcHandler</code><a class="reference internal" href="_modules/grpc.html#GenericRpcHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.GenericRpcHandler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An implementation of arbitrarily many RPC methods.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.GenericRpcHandler.service">
|
||
<em class="property">abstract </em><code class="sig-name descname">service</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">handler_call_details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#GenericRpcHandler.service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.GenericRpcHandler.service" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the handler for servicing the RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>handler_call_details</strong> – A HandlerCallDetails describing the RPC.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An RpcMethodHandler with which the RPC may be serviced if the
|
||
implementation chooses to service this RPC, or None otherwise.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.ServiceRpcHandler">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServiceRpcHandler</code><a class="reference internal" href="_modules/grpc.html#ServiceRpcHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServiceRpcHandler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>An implementation of RPC methods belonging to a service.</p>
|
||
<p>A service handles RPC methods with structured names of the form
|
||
‘/Service.Name/Service.Method’, where ‘Service.Name’ is the value
|
||
returned by service_name(), and ‘Service.Method’ is the method
|
||
name. A service can have multiple method names, but only a single
|
||
service name.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.ServiceRpcHandler.service_name">
|
||
<em class="property">abstract </em><code class="sig-name descname">service_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServiceRpcHandler.service_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServiceRpcHandler.service_name" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns this service’s name.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>The service name.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="service-side-interceptor">
|
||
<h3>Service-Side Interceptor<a class="headerlink" href="#service-side-interceptor" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.ServerInterceptor">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServerInterceptor</code><a class="reference internal" href="_modules/grpc.html#ServerInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerInterceptor" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords intercepting incoming RPCs on the service-side.</p>
|
||
<p>This is an EXPERIMENTAL API.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.ServerInterceptor.intercept_service">
|
||
<em class="property">abstract </em><code class="sig-name descname">intercept_service</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">handler_call_details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServerInterceptor.intercept_service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerInterceptor.intercept_service" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Intercepts incoming RPCs before handing them over to a handler.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>continuation</strong> – A function that takes a HandlerCallDetails and
|
||
proceeds to invoke the next interceptor in the chain, if any,
|
||
or the RPC handler lookup logic, with the call details passed
|
||
as an argument, and returns an RpcMethodHandler instance if
|
||
the RPC is considered serviced, or None otherwise.</p></li>
|
||
<li><p><strong>handler_call_details</strong> – A HandlerCallDetails describing the RPC.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An RpcMethodHandler with which the RPC may be serviced if the
|
||
interceptor chooses to service this RPC, or None otherwise.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="multi-callable-interfaces">
|
||
<h3>Multi-Callable Interfaces<a class="headerlink" href="#multi-callable-interfaces" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.UnaryUnaryMultiCallable">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryUnaryMultiCallable</code><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords invoking a unary-unary RPC from client-side.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.UnaryUnaryMultiCallable.__call__">
|
||
<em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Synchronously invokes the underlying RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request</strong> – The request value for the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow
|
||
for the RPC.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The response value for the RPC.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
|
||
raised RpcError will also be a Call for the RPC affording the RPC’s
|
||
metadata, status code, and details.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.UnaryUnaryMultiCallable.future">
|
||
<em class="property">abstract </em><code class="sig-name descname">future</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable.future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable.future" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Asynchronously invokes the underlying RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request</strong> – The request value for the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
|
||
the RPC.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
|
||
In the event of RPC completion, the return Call-Future’s result
|
||
value will be the response message of the RPC.
|
||
Should the event terminate with non-OK status,
|
||
the returned Call-Future’s exception value will be an RpcError.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.UnaryUnaryMultiCallable.with_call">
|
||
<em class="property">abstract </em><code class="sig-name descname">with_call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable.with_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable.with_call" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Synchronously invokes the underlying RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request</strong> – The request value for the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional durating of time in seconds to allow for
|
||
the RPC.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The response value for the RPC and a Call value for the RPC.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
|
||
raised RpcError will also be a Call for the RPC affording the RPC’s
|
||
metadata, status code, and details.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.UnaryStreamMultiCallable">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryStreamMultiCallable</code><a class="reference internal" href="_modules/grpc.html#UnaryStreamMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamMultiCallable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords invoking a unary-stream RPC from client-side.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.UnaryStreamMultiCallable.__call__">
|
||
<em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryStreamMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Invokes the underlying RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request</strong> – The request value for the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
|
||
the RPC. If None, the timeout is considered infinite.</p></li>
|
||
<li><p><strong>metadata</strong> – An optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
|
||
response values. Drawing response values from the returned
|
||
Call-iterator may raise RpcError indicating termination of the
|
||
RPC with non-OK status.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.StreamUnaryMultiCallable">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamUnaryMultiCallable</code><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords invoking a stream-unary RPC from client-side.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.StreamUnaryMultiCallable.__call__">
|
||
<em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Synchronously invokes the underlying RPC.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request_iterator</strong> – An iterator that yields request values for
|
||
the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
|
||
the RPC. If None, the timeout is considered infinite.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The response value for the RPC.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
|
||
raised RpcError will also implement grpc.Call, affording methods
|
||
such as metadata, code, and details.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.StreamUnaryMultiCallable.future">
|
||
<em class="property">abstract </em><code class="sig-name descname">future</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable.future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable.future" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Asynchronously invokes the underlying RPC on the client.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
|
||
the RPC. If None, the timeout is considered infinite.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
|
||
In the event of RPC completion, the return Call-Future’s result value
|
||
will be the response message of the RPC. Should the event terminate
|
||
with non-OK status, the returned Call-Future’s exception value will
|
||
be an RpcError.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.StreamUnaryMultiCallable.with_call">
|
||
<em class="property">abstract </em><code class="sig-name descname">with_call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable.with_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable.with_call" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Synchronously invokes the underlying RPC on the client.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request_iterator</strong> – An iterator that yields request values for
|
||
the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
|
||
the RPC. If None, the timeout is considered infinite.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The response value for the RPC and a Call object for the RPC.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
|
||
raised RpcError will also be a Call for the RPC affording the RPC’s
|
||
metadata, status code, and details.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.StreamStreamMultiCallable">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamStreamMultiCallable</code><a class="reference internal" href="_modules/grpc.html#StreamStreamMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamMultiCallable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Affords invoking a stream-stream RPC on client-side.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.StreamStreamMultiCallable.__call__">
|
||
<em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamStreamMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Invokes the underlying RPC on the client.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
|
||
<li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
|
||
the RPC. If not specified, the timeout is considered infinite.</p></li>
|
||
<li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
|
||
service-side of the RPC.</p></li>
|
||
<li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
|
||
secure Channel.</p></li>
|
||
<li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
|
||
flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
|
||
<li><p><strong>compression</strong> – An element of grpc.compression, e.g.
|
||
grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
|
||
response values. Drawing response values from the returned
|
||
Call-iterator may raise RpcError indicating termination of the
|
||
RPC with non-OK status.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="future-interfaces">
|
||
<h3>Future Interfaces<a class="headerlink" href="#future-interfaces" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py exception">
|
||
<dt id="grpc.FutureTimeoutError">
|
||
<em class="property">exception </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">FutureTimeoutError</code><a class="reference internal" href="_modules/grpc.html#FutureTimeoutError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.FutureTimeoutError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Indicates that a method call on a Future timed out.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt id="grpc.FutureCancelledError">
|
||
<em class="property">exception </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">FutureCancelledError</code><a class="reference internal" href="_modules/grpc.html#FutureCancelledError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.FutureCancelledError" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Indicates that the computation underlying a Future was cancelled.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="grpc.Future">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Future</code><a class="reference internal" href="_modules/grpc.html#Future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>A representation of a computation in another control flow.</p>
|
||
<p>Computations represented by a Future may be yet to be begun,
|
||
may be ongoing, or may have already completed.</p>
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.add_done_callback">
|
||
<em class="property">abstract </em><code class="sig-name descname">add_done_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">fn</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.add_done_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.add_done_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Adds a function to be called at completion of the computation.</p>
|
||
<p>The callback will be passed this Future object describing the outcome
|
||
of the computation. Callbacks will be invoked after the future is
|
||
terminated, whether successfully or not.</p>
|
||
<p>If the computation has already completed, the callback will be called
|
||
immediately.</p>
|
||
<p>Exceptions raised in the callback will be logged at ERROR level, but
|
||
will not terminate any threads of execution.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>fn</strong> – A callable taking this Future object as its single parameter.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.cancel">
|
||
<em class="property">abstract </em><code class="sig-name descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.cancel" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Attempts to cancel the computation.</p>
|
||
<p>This method does not block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><p>Returns True if the computation was canceled.</p>
|
||
<p>Returns False under all other circumstances, for example:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>computation has begun and could not be canceled.</p></li>
|
||
<li><p>computation has finished</p></li>
|
||
<li><dl class="simple">
|
||
<dt>computation is scheduled for execution and it is impossible</dt><dd><p>to determine its state without blocking.</p>
|
||
</dd>
|
||
</dl>
|
||
</li>
|
||
</ol>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>bool</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.cancelled">
|
||
<em class="property">abstract </em><code class="sig-name descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.cancelled" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes whether the computation was cancelled.</p>
|
||
<p>This method does not block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><p>Returns True if the computation was cancelled before its result became
|
||
available.</p>
|
||
<p>Returns False under all other circumstances, for example:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>computation was not cancelled.</p></li>
|
||
<li><p>computation’s result is available.</p></li>
|
||
</ol>
|
||
</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>bool</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.done">
|
||
<em class="property">abstract </em><code class="sig-name descname">done</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.done"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.done" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes whether the computation has taken place.</p>
|
||
<p>This method does not block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>Returns True if the computation already executed or was cancelled.
|
||
Returns False if the computation is scheduled for execution or
|
||
currently executing.
|
||
This is exactly opposite of the running() method’s result.</p>
|
||
</dd>
|
||
<dt class="field-even">Return type</dt>
|
||
<dd class="field-even"><p>bool</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.exception">
|
||
<em class="property">abstract </em><code class="sig-name descname">exception</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.exception" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the exception raised by the computation.</p>
|
||
<p>This method may return immediately or may block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>timeout</strong> – The length of time in seconds to wait for the computation to
|
||
terminate or be cancelled. If None, the call will block until the
|
||
computations’s termination.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The exception raised by the computation, or None if the computation
|
||
did not raise an exception.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><strong>FutureTimeoutError</strong></a> – If a timeout value is passed and the computation
|
||
does not terminate within the allotted time.</p></li>
|
||
<li><p><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><strong>FutureCancelledError</strong></a> – If the computation was cancelled.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.result">
|
||
<em class="property">abstract </em><code class="sig-name descname">result</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.result"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.result" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Returns the result of the computation or raises its exception.</p>
|
||
<p>This method may return immediately or may block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>timeout</strong> – The length of time in seconds to wait for the computation to
|
||
finish or be cancelled. If None, the call will block until the
|
||
computations’s termination.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The return value of the computation.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><strong>FutureTimeoutError</strong></a> – If a timeout value is passed and the computation
|
||
does not terminate within the allotted time.</p></li>
|
||
<li><p><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><strong>FutureCancelledError</strong></a> – If the computation was cancelled.</p></li>
|
||
<li><p><strong>Exception</strong> – If the computation raised an exception, this call will
|
||
raise the same exception.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.running">
|
||
<em class="property">abstract </em><code class="sig-name descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.running"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.running" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Describes whether the computation is taking place.</p>
|
||
<p>This method does not block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><p>Returns True if the computation is scheduled for execution or
|
||
currently executing.</p>
|
||
<p>Returns False if the computation already executed or was cancelled.</p>
|
||
</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="grpc.Future.traceback">
|
||
<em class="property">abstract </em><code class="sig-name descname">traceback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.traceback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.traceback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Access the traceback of the exception raised by the computation.</p>
|
||
<p>This method may return immediately or may block.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>timeout</strong> – The length of time in seconds to wait for the computation
|
||
to terminate or be cancelled. If None, the call will block until
|
||
the computation’s termination.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The traceback of the exception raised by the computation, or None
|
||
if the computation did not raise an exception.</p>
|
||
</dd>
|
||
<dt class="field-odd">Raises</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><strong>FutureTimeoutError</strong></a> – If a timeout value is passed and the computation
|
||
does not terminate within the allotted time.</p></li>
|
||
<li><p><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><strong>FutureCancelledError</strong></a> – If the computation was cancelled.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="compression">
|
||
<h3>Compression<a class="headerlink" href="#compression" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py class">
|
||
<dt id="grpc.Compression">
|
||
<em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Compression</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Compression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Compression" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Indicates the compression method to be used for an RPC.</p>
|
||
<p>This enumeration is part of an EXPERIMENTAL API.</p>
|
||
<dl class="py attribute">
|
||
<dt id="grpc.Compression.NoCompression">
|
||
<code class="sig-name descname">NoCompression</code><a class="headerlink" href="#grpc.Compression.NoCompression" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Do not use compression algorithm.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.Compression.Deflate">
|
||
<code class="sig-name descname">Deflate</code><a class="headerlink" href="#grpc.Compression.Deflate" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Use “Deflate” compression algorithm.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="grpc.Compression.Gzip">
|
||
<code class="sig-name descname">Gzip</code><a class="headerlink" href="#grpc.Compression.Gzip" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Use “Gzip” compression algorithm.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
</div>
|
||
<div class="section" id="runtime-protobuf-parsing">
|
||
<h3>Runtime Protobuf Parsing<a class="headerlink" href="#runtime-protobuf-parsing" title="Permalink to this headline">¶</a></h3>
|
||
<dl class="py function">
|
||
<dt id="grpc.protos">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">protos</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/_runtime_protos.html#protos"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.protos" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.services">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">services</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/_runtime_protos.html#services"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.services" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="grpc.protos_and_services">
|
||
<code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">protos_and_services</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/_runtime_protos.html#protos_and_services"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.protos_and_services" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2020, The gRPC Authors.
|
||
|
||
|
|
||
<a href="_sources/grpc.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
|
||
var _gaq = _gaq || [];
|
||
_gaq.push(['_setAccount', 'UA-60127042-1']);
|
||
_gaq.push(['_setDomainName', 'none']);
|
||
_gaq.push(['_setAllowLinker', true]);
|
||
_gaq.push(['_trackPageview']);
|
||
|
||
(function() {
|
||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||
})();
|
||
|
||
</script>
|
||
|
||
</body>
|
||
</html> |