grpc/python/grpc_reflection.html

336 lines
23 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>gRPC Reflection &#8212; gRPC Python 1.64.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=4f649999" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=8090fdca" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js?v=057799ce"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=4825356b"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="gRPC Status" href="grpc_status.html" />
<link rel="prev" title="gRPC Health Checking" href="grpc_health_checking.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.64.0</p>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="grpc.html">gRPC</a></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_admin.html">gRPC Admin</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_csds.html">gRPC CSDS</a></li>
<li class="toctree-l1"><a class="reference internal" href="grpc_health_checking.html">gRPC Health Checking</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">gRPC Reflection</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#what-is-grpc-reflection">What is gRPC reflection?</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="#module-grpc_reflection.v1alpha.reflection">Server-side</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#grpc_reflection.v1alpha.reflection.ReflectionServicer"><code class="docutils literal notranslate"><span class="pre">ReflectionServicer</span></code></a><ul>
<li class="toctree-l5"><a class="reference internal" href="#grpc_reflection.v1alpha.reflection.ReflectionServicer.ServerReflectionInfo"><code class="docutils literal notranslate"><span class="pre">ReflectionServicer.ServerReflectionInfo()</span></code></a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#grpc_reflection.v1alpha.reflection.enable_server_reflection"><code class="docutils literal notranslate"><span class="pre">enable_server_reflection()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#module-grpc_reflection.v1alpha.proto_reflection_descriptor_database">Client-side</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase"><code class="docutils literal notranslate"><span class="pre">ProtoReflectionDescriptorDatabase</span></code></a><ul>
<li class="toctree-l5"><a class="reference internal" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.get_services"><code class="docutils literal notranslate"><span class="pre">ProtoReflectionDescriptorDatabase.get_services()</span></code></a></li>
<li class="toctree-l5"><a class="reference internal" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileByName"><code class="docutils literal notranslate"><span class="pre">ProtoReflectionDescriptorDatabase.FindFileByName()</span></code></a></li>
<li class="toctree-l5"><a class="reference internal" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileContainingSymbol"><code class="docutils literal notranslate"><span class="pre">ProtoReflectionDescriptorDatabase.FindFileContainingSymbol()</span></code></a></li>
<li class="toctree-l5"><a class="reference internal" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindAllExtensionNumbers"><code class="docutils literal notranslate"><span class="pre">ProtoReflectionDescriptorDatabase.FindAllExtensionNumbers()</span></code></a></li>
<li class="toctree-l5"><a class="reference internal" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileContainingExtension"><code class="docutils literal notranslate"><span class="pre">ProtoReflectionDescriptorDatabase.FindFileContainingExtension()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</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="grpc_observability.html">gRPC Python Observability</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="grpc_health_checking.html" title="previous chapter">gRPC Health Checking</a></li>
<li>Next: <a href="grpc_status.html" title="next chapter">gRPC Status</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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="grpc-reflection">
<h1>gRPC Reflection<a class="headerlink" href="#grpc-reflection" title="Permalink to this heading"></a></h1>
<section id="what-is-grpc-reflection">
<h2>What is gRPC reflection?<a class="headerlink" href="#what-is-grpc-reflection" title="Permalink to this heading"></a></h2>
<p>Check this out <a class="reference external" href="https://github.com/grpc/grpc/blob/master/doc/python/server_reflection.md">gRPC Python Server Reflection</a></p>
</section>
<section id="example">
<h2>Example<a class="headerlink" href="#example" title="Permalink to this heading"></a></h2>
<p>Refer to the GitHub <a class="reference external" href="https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_server_with_reflection.py">reflection example</a></p>
</section>
<section id="module-contents">
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this heading"></a></h2>
<section id="module-grpc_reflection.v1alpha.reflection">
<span id="server-side"></span><h3>Server-side<a class="headerlink" href="#module-grpc_reflection.v1alpha.reflection" title="Permalink to this heading"></a></h3>
<p>Reference implementation for reflection in gRPC Python.</p>
<dl class="py class">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.reflection.ReflectionServicer">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">grpc_reflection.v1alpha.reflection.</span></span><span class="sig-name descname"><span class="pre">ReflectionServicer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_names</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/reflection.html#ReflectionServicer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.reflection.ReflectionServicer" title="Permalink to this definition"></a></dt>
<dd><p>Servicer handling RPCs for service statuses.</p>
<dl class="py method">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.reflection.ReflectionServicer.ServerReflectionInfo">
<span class="sig-name descname"><span class="pre">ServerReflectionInfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request_iterator</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">context</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/reflection.html#ReflectionServicer.ServerReflectionInfo"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.reflection.ReflectionServicer.ServerReflectionInfo" title="Permalink to this definition"></a></dt>
<dd><p>The reflection service is structured as a bidirectional stream, ensuring
all related requests go to a single server.</p>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.reflection.enable_server_reflection">
<span class="sig-prename descclassname"><span class="pre">grpc_reflection.v1alpha.reflection.</span></span><span class="sig-name descname"><span class="pre">enable_server_reflection</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_names</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">server</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/reflection.html#enable_server_reflection"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.reflection.enable_server_reflection" title="Permalink to this definition"></a></dt>
<dd><p>Enables server reflection on a server.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_names</strong> Iterable of fully-qualified service names available.</p></li>
<li><p><strong>server</strong> grpc.Server to which reflection service will be added.</p></li>
<li><p><strong>pool</strong> DescriptorPool object to use (descriptor_pool.Default() if None).</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-grpc_reflection.v1alpha.proto_reflection_descriptor_database">
<span id="client-side"></span><h3>Client-side<a class="headerlink" href="#module-grpc_reflection.v1alpha.proto_reflection_descriptor_database" title="Permalink to this heading"></a></h3>
<p>Reference implementation for reflection client in gRPC Python.</p>
<p>For usage instructions, see the Python Reflection documentation at
<code class="docutils literal notranslate"><span class="pre">doc/python/server_reflection.md</span></code>.</p>
<dl class="py class">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">grpc_reflection.v1alpha.proto_reflection_descriptor_database.</span></span><span class="sig-name descname"><span class="pre">ProtoReflectionDescriptorDatabase</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">channel</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/proto_reflection_descriptor_database.html#ProtoReflectionDescriptorDatabase"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase" title="Permalink to this definition"></a></dt>
<dd><p>A container and interface for receiving descriptors from a servers
Reflection service.</p>
<p>ProtoReflectionDescriptorDatabase takes a channel to a server with
Reflection service, and provides an interface to retrieve the Reflection
information. It implements the DescriptorDatabase interface.</p>
<p>It is typically used to feed a DescriptorPool instance.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>channel</strong> (<a class="reference internal" href="grpc.html#grpc.Channel" title="grpc.Channel"><em>Channel</em></a>) </p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.get_services">
<span class="sig-name descname"><span class="pre">get_services</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/proto_reflection_descriptor_database.html#ProtoReflectionDescriptorDatabase.get_services"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.get_services" title="Permalink to this definition"></a></dt>
<dd><p>Get list of full names of the registered services.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>A list of strings corresponding to the names of the services.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><em>Iterable</em>[str]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileByName">
<span class="sig-name descname"><span class="pre">FindFileByName</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/proto_reflection_descriptor_database.html#ProtoReflectionDescriptorDatabase.FindFileByName"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileByName" title="Permalink to this definition"></a></dt>
<dd><p>Find a file descriptor by file name.</p>
<p>This function implements a DescriptorDatabase interface, and is
typically not called directly; prefer using a DescriptorPool instead.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>name</strong> (<em>str</em>) The name of the file. Typically this is a relative path ending in “.proto”.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A FileDescriptorProto for the file.</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>KeyError</strong> the file was not found.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><em>FileDescriptorProto</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileContainingSymbol">
<span class="sig-name descname"><span class="pre">FindFileContainingSymbol</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">symbol</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/proto_reflection_descriptor_database.html#ProtoReflectionDescriptorDatabase.FindFileContainingSymbol"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileContainingSymbol" title="Permalink to this definition"></a></dt>
<dd><p>Find the file containing the symbol, and return its file descriptor.</p>
<p>The symbol should be a fully qualified name including the file
descriptors package and any containing messages. Some examples:</p>
<blockquote>
<div><ul class="simple">
<li><p>“some.package.name.Message”</p></li>
<li><p>“some.package.name.Message.NestedEnum”</p></li>
<li><p>“some.package.name.Message.some_field”</p></li>
</ul>
</div></blockquote>
<p>This function implements a DescriptorDatabase interface, and is
typically not called directly; prefer using a DescriptorPool instead.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>symbol</strong> (<em>str</em>) The fully-qualified name of the symbol.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>FileDescriptorProto for the file containing the symbol.</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>KeyError</strong> the symbol was not found.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><em>FileDescriptorProto</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindAllExtensionNumbers">
<span class="sig-name descname"><span class="pre">FindAllExtensionNumbers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">extendee_name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/proto_reflection_descriptor_database.html#ProtoReflectionDescriptorDatabase.FindAllExtensionNumbers"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindAllExtensionNumbers" title="Permalink to this definition"></a></dt>
<dd><p>Find the field numbers used by all known extensions of <cite>extendee_name</cite>.</p>
<p>This function implements a DescriptorDatabase interface, and is
typically not called directly; prefer using a DescriptorPool instead.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>extendee_name</strong> (<em>str</em>) fully-qualified name of the extended message type.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A list of field numbers used by all known extensions.</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>KeyError</strong> The message type <cite>extendee_name</cite> was not found.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><em>Iterable</em>[int]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileContainingExtension">
<span class="sig-name descname"><span class="pre">FindFileContainingExtension</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">extendee_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">extension_number</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_reflection/v1alpha/proto_reflection_descriptor_database.html#ProtoReflectionDescriptorDatabase.FindFileContainingExtension"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc_reflection.v1alpha.proto_reflection_descriptor_database.ProtoReflectionDescriptorDatabase.FindFileContainingExtension" title="Permalink to this definition"></a></dt>
<dd><p>Find the file which defines an extension for the given message type
and field number.</p>
<p>This function implements a DescriptorDatabase interface, and is
typically not called directly; prefer using a DescriptorPool instead.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>extendee_name</strong> (<em>str</em>) fully-qualified name of the extended message type.</p></li>
<li><p><strong>extension_number</strong> (<em>int</em>) the number of the extension field.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>FileDescriptorProto for the file containing the extension.</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>KeyError</strong> The message or the extension number were not found.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><em>FileDescriptorProto</em></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2020, The gRPC Authors.
|
<a href="_sources/grpc_reflection.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>