| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419 | 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en">  <head>    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>gRPC — gRPC Python 1.18.0 documentation</title>    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />    <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>    <script type="text/javascript" src="_static/jquery.js"></script>    <script type="text/javascript" src="_static/underscore.js"></script>    <script type="text/javascript" src="_static/doctools.js"></script>    <script type="text/javascript" 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 Channelz" href="grpc_channelz.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.18.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="#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></ul></li></ul></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_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_channelz.html" title="next chapter">gRPC Channelz</a></li>  </ul></li></ul></div><div id="searchbox" style="display: none" role="search">  <h3>Quick search</h3>    <div class="searchformwrapper">    <form class="search" action="search.html" method="get">      <input type="text" name="q" />      <input type="submit" value="Go" />      <input type="hidden" name="check_keywords" value="yes" />      <input type="hidden" name="area" value="default" />    </form>    </div></div><script type="text/javascript">$('#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/quickstart/python.html">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/tutorials/basic/python.html">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="function"><dt id="grpc.insecure_channel"><code class="descclassname">grpc.</code><code class="descname">insecure_channel</code><span class="sig-paren">(</span><em>target</em>, <em>options=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>target</strong> – The server address</li><li><strong>options</strong> – An optional list of key-value pairs (channel argsin gRPC Core runtime) to configure the channel.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Channel.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.secure_channel"><code class="descclassname">grpc.</code><code class="descname">secure_channel</code><span class="sig-paren">(</span><em>target</em>, <em>credentials</em>, <em>options=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>target</strong> – The server address.</li><li><strong>credentials</strong> – A ChannelCredentials instance.</li><li><strong>options</strong> – An optional list of key-value pairs (channel argsin gRPC Core runtime) to configure the channel.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Channel.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.intercept_channel"><code class="descclassname">grpc.</code><code class="descname">intercept_channel</code><span class="sig-paren">(</span><em>channel</em>, <em>*interceptors</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>channel</strong> – A Channel.</li><li><strong>interceptors</strong> – Zero or more objects of typeUnaryUnaryClientInterceptor,UnaryStreamClientInterceptor,StreamUnaryClientInterceptor, orStreamStreamClientInterceptor.Interceptors are given control in the order they are listed.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A Channel that intercepts each invocation via the provided interceptors.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code> – If interceptor does not derive from any ofUnaryUnaryClientInterceptor,UnaryStreamClientInterceptor,StreamUnaryClientInterceptor, orStreamStreamClientInterceptor.</p></td></tr></tbody></table></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="function"><dt id="grpc.ssl_channel_credentials"><code class="descclassname">grpc.</code><code class="descname">ssl_channel_credentials</code><span class="sig-paren">(</span><em>root_certificates=None</em>, <em>private_key=None</em>, <em>certificate_chain=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>root_certificates</strong> – The PEM-encoded root certificates as a byte string,or None to retrieve them from a default location chosen by gRPCruntime.</li><li><strong>private_key</strong> – The PEM-encoded private key as a byte string, or None if noprivate key should be used.</li><li><strong>certificate_chain</strong> – The PEM-encoded certificate chain as a byte stringto use or or None if no certificate chain should be used.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A ChannelCredentials for use with an SSL-enabled Channel.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.metadata_call_credentials"><code class="descclassname">grpc.</code><code class="descname">metadata_call_credentials</code><span class="sig-paren">(</span><em>metadata_plugin</em>, <em>name=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>metadata_plugin</strong> – An AuthMetadataPlugin to use for authentication.</li><li><strong>name</strong> – An optional name for the plugin.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A CallCredentials.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.access_token_call_credentials"><code class="descclassname">grpc.</code><code class="descname">access_token_call_credentials</code><span class="sig-paren">(</span><em>access_token</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>access_token</strong> – A string to place directly in the http requestauthorization header, for example“authorization: Bearer <access_token>”.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A CallCredentials.</td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.composite_call_credentials"><code class="descclassname">grpc.</code><code class="descname">composite_call_credentials</code><span class="sig-paren">(</span><em>*call_credentials</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>*call_credentials</strong> – At least two CallCredentials objects.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A CallCredentials object composed of the given CallCredentials objects.</td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.composite_channel_credentials"><code class="descclassname">grpc.</code><code class="descname">composite_channel_credentials</code><span class="sig-paren">(</span><em>channel_credentials</em>, <em>*call_credentials</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>channel_credentials</strong> – A ChannelCredentials object.</li><li><strong>*call_credentials</strong> – One or more CallCredentials objects.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils"><dt>A ChannelCredentials composed of the given ChannelCredentials and</dt><dd><p class="first last">CallCredentials objects.</p></dd></dl></p></td></tr></tbody></table></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="function"><dt id="grpc.server"><code class="descclassname">grpc.</code><code class="descname">server</code><span class="sig-paren">(</span><em>thread_pool</em>, <em>handlers=None</em>, <em>interceptors=None</em>, <em>options=None</em>, <em>maximum_concurrent_rpcs=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>thread_pool</strong> – A futures.ThreadPoolExecutor to be used by the Serverto execute RPC handlers.</li><li><strong>handlers</strong> – An optional list of GenericRpcHandlers used for executing RPCs.More handlers may be added by calling add_generic_rpc_handlers any timebefore the server is started.</li><li><strong>interceptors</strong> – An optional list of ServerInterceptor objects that observeand optionally manipulate the incoming RPCs before handing them over tohandlers. The interceptors are given control in the order they arespecified. This is an EXPERIMENTAL API.</li><li><strong>options</strong> – An optional list of key-value pairs (channel args in gRPC runtime)to configure the channel.</li><li><strong>maximum_concurrent_rpcs</strong> – The maximum number of concurrent RPCs this serverwill service before returning RESOURCE_EXHAUSTED status, or None toindicate no limit.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Server object.</p></td></tr></tbody></table></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="function"><dt id="grpc.ssl_server_credentials"><code class="descclassname">grpc.</code><code class="descname">ssl_server_credentials</code><span class="sig-paren">(</span><em>private_key_certificate_chain_pairs</em>, <em>root_certificates=None</em>, <em>require_client_auth=False</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>private_key_certificate_chain_pairs</strong> – A list of pairs of the form[PEM-encoded private key, PEM-encoded certificate chain].</li><li><strong>root_certificates</strong> – An optional byte string of PEM-encoded client rootcertificates that the server will use to verify client authentication.If omitted, require_client_auth must also be False.</li><li><strong>require_client_auth</strong> – A boolean indicating whether or not to requireclients to be authenticated. May only be True if root_certificatesis not None.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A ServerCredentials for use with an SSL-enabled Server. Typically, thisobject is an argument to add_secure_port() method during server setup.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.ssl_server_certificate_configuration"><code class="descclassname">grpc.</code><code class="descname">ssl_server_certificate_configuration</code><span class="sig-paren">(</span><em>private_key_certificate_chain_pairs</em>, <em>root_certificates=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>private_key_certificate_chain_pairs</strong> – A collection of pairs ofthe form [PEM-encoded private key, PEM-encoded certificatechain].</li><li><strong>root_certificates</strong> – An optional byte string of PEM-encoded client rootcertificates that the server will use to verify client authentication.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils"><dt>A ServerCertificateConfiguration that can be returned in the certificate</dt><dd><p class="first last">configuration fetching callback.</p></dd></dl></p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.dynamic_ssl_server_credentials"><code class="descclassname">grpc.</code><code class="descname">dynamic_ssl_server_credentials</code><span class="sig-paren">(</span><em>initial_certificate_configuration</em>, <em>certificate_configuration_fetcher</em>, <em>require_client_authentication=False</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>initial_certificate_configuration</strong> (<a class="reference internal" href="#grpc.ServerCertificateConfiguration" title="grpc.ServerCertificateConfiguration"><em>ServerCertificateConfiguration</em></a>) – Thecertificate configuration with which the server will be initialized.</li><li><strong>certificate_configuration_fetcher</strong> (<em>callable</em>) – A callable that takes noarguments and should return a ServerCertificateConfiguration toreplace the server’s current certificate, or None for no change(i.e., the server will continue its current certificateconfig). The library will call this callback on <em>every</em> newclient connection before starting the TLS handshake with theclient, thus allowing the user application to optionallyreturn a new ServerCertificateConfiguration that the server will thenuse for the handshake.</li><li><strong>require_client_authentication</strong> – A boolean indicating whether or not torequire clients to be authenticated.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A ServerCredentials.</p></td></tr></tbody></table></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="function"><dt id="grpc.unary_unary_rpc_method_handler"><code class="descclassname">grpc.</code><code class="descname">unary_unary_rpc_method_handler</code><span class="sig-paren">(</span><em>behavior</em>, <em>request_deserializer=None</em>, <em>response_serializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>behavior</strong> – The implementation of an RPC that accepts one requestand returns one response.</li><li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li><li><strong>response_serializer</strong> – An optional behavior for response serialization.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An RpcMethodHandler object that is typically used by grpc.Server.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.unary_stream_rpc_method_handler"><code class="descclassname">grpc.</code><code class="descname">unary_stream_rpc_method_handler</code><span class="sig-paren">(</span><em>behavior</em>, <em>request_deserializer=None</em>, <em>response_serializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>behavior</strong> – The implementation of an RPC that accepts one requestand returns an iterator of response values.</li><li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li><li><strong>response_serializer</strong> – An optional behavior for response serialization.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An RpcMethodHandler object that is typically used by grpc.Server.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.stream_unary_rpc_method_handler"><code class="descclassname">grpc.</code><code class="descname">stream_unary_rpc_method_handler</code><span class="sig-paren">(</span><em>behavior</em>, <em>request_deserializer=None</em>, <em>response_serializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>behavior</strong> – The implementation of an RPC that accepts an iterator ofrequest values and returns a single response value.</li><li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li><li><strong>response_serializer</strong> – An optional behavior for response serialization.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An RpcMethodHandler object that is typically used by grpc.Server.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.stream_stream_rpc_method_handler"><code class="descclassname">grpc.</code><code class="descname">stream_stream_rpc_method_handler</code><span class="sig-paren">(</span><em>behavior</em>, <em>request_deserializer=None</em>, <em>response_serializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>behavior</strong> – The implementation of an RPC that accepts an iterator ofrequest values and returns an iterator of response values.</li><li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li><li><strong>response_serializer</strong> – An optional behavior for response serialization.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An RpcMethodHandler object that is typically used by grpc.Server.</p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.method_handlers_generic_handler"><code class="descclassname">grpc.</code><code class="descname">method_handlers_generic_handler</code><span class="sig-paren">(</span><em>service</em>, <em>method_handlers</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>service</strong> – The name of the service that is implemented by themethod_handlers.</li><li><strong>method_handlers</strong> – A dictionary that maps method names to correspondingRpcMethodHandler.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A GenericRpcHandler. This is typically added to the grpc.Server objectwith add_generic_rpc_handlers() before starting the server.</p></td></tr></tbody></table></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="function"><dt id="grpc.channel_ready_future"><code class="descclassname">grpc.</code><code class="descname">channel_ready_future</code><span class="sig-paren">(</span><em>channel</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>channel</strong> – A Channel object.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A Future object that matures when the channel connectivity isChannelConnectivity.READY.</td></tr></tbody></table></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="class"><dt id="grpc.ChannelConnectivity"><em class="property">class </em><code class="descclassname">grpc.</code><code class="descname">ChannelConnectivity</code><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="attribute"><dt id="grpc.ChannelConnectivity.IDLE"><code class="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="attribute"><dt id="grpc.ChannelConnectivity.CONNECTING"><code class="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="attribute"><dt id="grpc.ChannelConnectivity.READY"><code class="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="attribute"><dt id="grpc.ChannelConnectivity.TRANSIENT_FAILURE"><code class="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 expectsto recover.</p></dd></dl><dl class="attribute"><dt id="grpc.ChannelConnectivity.SHUTDOWN"><code class="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="class"><dt id="grpc.StatusCode"><em class="property">class </em><code class="descclassname">grpc.</code><code class="descname">StatusCode</code><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="attribute"><dt id="grpc.StatusCode.OK"><code class="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="attribute"><dt id="grpc.StatusCode.CANCELLED"><code class="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="attribute"><dt id="grpc.StatusCode.UNKNOWN"><code class="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="attribute"><dt id="grpc.StatusCode.INVALID_ARGUMENT"><code class="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="attribute"><dt id="grpc.StatusCode.DEADLINE_EXCEEDED"><code class="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="attribute"><dt id="grpc.StatusCode.NOT_FOUND"><code class="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="attribute"><dt id="grpc.StatusCode.ALREADY_EXISTS"><code class="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="attribute"><dt id="grpc.StatusCode.PERMISSION_DENIED"><code class="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 specifiedoperation.</p></dd></dl><dl class="attribute"><dt id="grpc.StatusCode.UNAUTHENTICATED"><code class="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 theoperation.</p></dd></dl><dl class="attribute"><dt id="grpc.StatusCode.RESOURCE_EXHAUSTED"><code class="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, orperhaps the entire file system is out of space.</p></dd></dl><dl class="attribute"><dt id="grpc.StatusCode.FAILED_PRECONDITION"><code class="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 staterequired for the operation’s execution.</p></dd></dl><dl class="attribute"><dt id="grpc.StatusCode.ABORTED"><code class="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 issuelike sequencer check failures, transaction aborts, etc.</p></dd></dl><dl class="attribute"><dt id="grpc.StatusCode.UNIMPLEMENTED"><code class="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="attribute"><dt id="grpc.StatusCode.INTERNAL"><code class="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 underlyingsystem has been broken.</p></dd></dl><dl class="attribute"><dt id="grpc.StatusCode.UNAVAILABLE"><code class="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="attribute"><dt id="grpc.StatusCode.DATA_LOSS"><code class="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="class"><dt id="grpc.Channel"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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 notsupport being entered and exited multiple times.</p><dl class="method"><dt id="grpc.Channel.close"><code class="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 theChannel and it is not valid to invoke new RPCs with the Channel.</p><p>This method is idempotent.</p></dd></dl><dl class="method"><dt id="grpc.Channel.stream_stream"><code class="descname">stream_stream</code><span class="sig-paren">(</span><em>method</em>, <em>request_serializer=None</em>, <em>response_deserializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>method</strong> – The name of the RPC method.</li><li><strong>request_serializer</strong> – Optional behaviour for serializing the requestmessage. Request goes unserialized in case None is passed.</li><li><strong>response_deserializer</strong> – Optional behaviour for deserializing theresponse message. Response goes undeserialized in case Noneis passed.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A StreamStreamMultiCallable value for the named stream-stream method.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Channel.stream_unary"><code class="descname">stream_unary</code><span class="sig-paren">(</span><em>method</em>, <em>request_serializer=None</em>, <em>response_deserializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>method</strong> – The name of the RPC method.</li><li><strong>request_serializer</strong> – Optional behaviour for serializing the requestmessage. Request goes unserialized in case None is passed.</li><li><strong>response_deserializer</strong> – Optional behaviour for deserializing theresponse message. Response goes undeserialized in case None ispassed.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A StreamUnaryMultiCallable value for the named stream-unary method.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Channel.subscribe"><code class="descname">subscribe</code><span class="sig-paren">(</span><em>callback</em>, <em>try_to_connect=False</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 gRPCruntime’s state.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"><li><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 subscriptionand again for every change to ChannelConnectivity until itis unsubscribed or this Channel object goes out of scope.</li><li><strong>try_to_connect</strong> – A boolean indicating whether or not this Channelshould attempt to connect immediately. If set to False, gRPCruntime decides when to connect.</li></ul></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Channel.unary_stream"><code class="descname">unary_stream</code><span class="sig-paren">(</span><em>method</em>, <em>request_serializer=None</em>, <em>response_deserializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>method</strong> – The name of the RPC method.</li><li><strong>request_serializer</strong> – Optional behaviour for serializing the requestmessage. Request goes unserialized in case None is passed.</li><li><strong>response_deserializer</strong> – Optional behaviour for deserializing theresponse message. Response goes undeserialized in case None ispassed.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A UnaryStreamMultiCallable value for the name unary-stream method.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Channel.unary_unary"><code class="descname">unary_unary</code><span class="sig-paren">(</span><em>method</em>, <em>request_serializer=None</em>, <em>response_deserializer=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>method</strong> – The name of the RPC method.</li><li><strong>request_serializer</strong> – Optional behaviour for serializing the requestmessage. Request goes unserialized in case None is passed.</li><li><strong>response_deserializer</strong> – Optional behaviour for deserializing theresponse message. Response goes undeserialized in case Noneis passed.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A UnaryUnaryMultiCallable value for the named unary-unary method.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Channel.unsubscribe"><code class="descname">unsubscribe</code><span class="sig-paren">(</span><em>callback</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"><li><strong>callback</strong> – A callable previously registered with this Channel from</li><li><strong>been passed to its "subscribe" method.</strong> (<em>having</em>) – </li></ul></td></tr></tbody></table></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="class"><dt id="grpc.Server"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.Server.add_generic_rpc_handlers"><code class="descname">add_generic_rpc_handlers</code><span class="sig-paren">(</span><em>generic_rpc_handlers</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"><li><strong>generic_rpc_handlers</strong> – An iterable of GenericRpcHandlers that will be</li><li><strong>to service RPCs.</strong> (<em>used</em>) – </li></ul></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Server.add_insecure_port"><code class="descname">add_insecure_port</code><span class="sig-paren">(</span><em>address</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>address</strong> – The address for which to open a port.</li><li><strong>the port is 0</strong><strong>, or </strong><strong>not specified in the address</strong><strong>, </strong><strong>then gRPC runtime</strong> (<em>if</em>) – </li><li><strong>choose a port.</strong> (<em>will</em>) – </li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An integer port on which server will accept RPC requests.</p></td></tr><tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">integer</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Server.add_secure_port"><code class="descname">add_secure_port</code><span class="sig-paren">(</span><em>address</em>, <em>server_credentials</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>address</strong> – The address for which to open a port.if the port is 0, or not specified in the address, then gRPCruntime will choose a port.</li><li><strong>server_credentials</strong> – A ServerCredentials object.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An integer port on which server will accept RPC requests.</p></td></tr><tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">integer</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Server.start"><code class="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="method"><dt id="grpc.Server.stop"><code class="descname">stop</code><span class="sig-paren">(</span><em>grace</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 immediatelyand 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 methodblocks 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 havethe effect of stopping the Server sooner (passing None willhave the effect of stopping the server immediately). Passinga larger grace value in a subsequent call <em>will not</em> have theeffect of stopping the server later (i.e. the most restrictivegrace value is used).</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>grace</strong> – A duration of time in seconds or None.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A threading.Event that will be set when this Server has completelystopped, i.e. when running RPCs either complete or are aborted andall handlers have terminated.</td></tr></tbody></table></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="class"><dt id="grpc.ChannelCredentials"><em class="property">class </em><code class="descclassname">grpc.</code><code class="descname">ChannelCredentials</code><span class="sig-paren">(</span><em>credentials</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 itsinstances and its instances exist to be passed to other functions. Forexample, ssl_channel_credentials returns an instance of this class andsecure_channel requires an instance of this class.</p></dd></dl><dl class="class"><dt id="grpc.CallCredentials"><em class="property">class </em><code class="descclassname">grpc.</code><code class="descname">CallCredentials</code><span class="sig-paren">(</span><em>credentials</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 may be composed with ChannelCredentials to always assertidentity for every call over that Channel.</p><p>This class has no supported interface - it exists to define the type of itsinstances and its instances exist to be passed to other functions.</p></dd></dl><dl class="class"><dt id="grpc.AuthMetadataContext"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="attribute"><dt id="grpc.AuthMetadataContext.service_url"><code class="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="attribute"><dt id="grpc.AuthMetadataContext.method_name"><code class="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="class"><dt id="grpc.AuthMetadataPluginCallback"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.AuthMetadataPluginCallback.__call__"><code class="descname">__call__</code><span class="sig-paren">(</span><em>metadata</em>, <em>error</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"><li><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.</li><li><strong>error</strong> – An Exception to indicate error or None to indicate success.</li></ul></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.AuthMetadataPlugin"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.AuthMetadataPlugin.__call__"><code class="descname">__call__</code><span class="sig-paren">(</span><em>context</em>, <em>callback</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>Implementations of this method must not block.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"><li><strong>context</strong> – An AuthMetadataContext providing information on the RPC thatthe plugin is being called to authenticate.</li><li><strong>callback</strong> – An AuthMetadataPluginCallback to be invoked eithersynchronously or asynchronously.</li></ul></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.ServerCredentials"><em class="property">class </em><code class="descclassname">grpc.</code><code class="descname">ServerCredentials</code><span class="sig-paren">(</span><em>credentials</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 itsinstances and its instances exist to be passed to other functions.</p></dd></dl><dl class="class"><dt id="grpc.ServerCertificateConfiguration"><em class="property">class </em><code class="descclassname">grpc.</code><code class="descname">ServerCertificateConfiguration</code><span class="sig-paren">(</span><em>certificate_configuration</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 configurationfetching callback.</p><p>This class has no supported interface – it exists to define thetype of its instances and its instances exist to be passed toother 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="exception"><dt id="grpc.RpcError"><em class="property">exception </em><code class="descclassname">grpc.</code><code class="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="class"><dt id="grpc.RpcContext"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.RpcContext.add_callback"><code class="descname">add_callback</code><span class="sig-paren">(</span><em>callback</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>callback</strong> – A no-parameter callable to be called on RPC termination.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if the callback was added and will be called later; False ifthe callback was not added and will not be called (because the RPCalready terminated or some other reason).</td></tr><tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.RpcContext.cancel"><code class="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="method"><dt id="grpc.RpcContext.is_active"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if RPC is active, False otherwise.</td></tr><tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.RpcContext.time_remaining"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A nonnegative float indicating the length of allowed time in secondsremaining for the RPC to complete before it is considered to havetimed out, or None if no deadline was specified for the RPC.</td></tr></tbody></table></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="class"><dt id="grpc.Call"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.Call.code"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The StatusCode value for the RPC.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Call.details"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The details string of the RPC.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Call.initial_metadata"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Call.trailing_metadata"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</td></tr></tbody></table></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="class"><dt id="grpc.ClientCallDetails"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="attribute"><dt id="grpc.ClientCallDetails.method"><code class="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="attribute"><dt id="grpc.ClientCallDetails.timeout"><code class="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="attribute"><dt id="grpc.ClientCallDetails.metadata"><code class="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 tothe service-side of the RPC.</p></dd></dl><dl class="attribute"><dt id="grpc.ClientCallDetails.credentials"><code class="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="attribute"><dt id="grpc.ClientCallDetails.wait_for_ready"><code class="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 tenable wait for ready mechanism.</p></dd></dl></dd></dl><dl class="class"><dt id="grpc.UnaryUnaryClientInterceptor"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.UnaryUnaryClientInterceptor.intercept_unary_unary"><code class="descname">intercept_unary_unary</code><span class="sig-paren">(</span><em>continuation</em>, <em>client_call_details</em>, <em>request</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>continuation</strong> – A function that proceeds with the invocation byexecuting the next interceptor in chain or invoking theactual RPC on the underlying Channel. It is the interceptor’sresponsibility 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 isboth a Call for the RPC and a Future. In the event of RPCcompletion, the return Call-Future’s result value will bethe response message of the RPC. Should the event terminatewith non-OK status, the returned Call-Future’s exception valuewill be an RpcError.</li><li><strong>client_call_details</strong> – A ClientCallDetails object describing theoutgoing RPC.</li><li><strong>request</strong> – The request value for the RPC.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and a Future.In the event of RPC completion, the return Call-Future’sresult value will be the response message of the RPC.Should the event terminate with non-OK status, the returnedCall-Future’s exception value will be an RpcError.</p></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.UnaryStreamClientInterceptor"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.UnaryStreamClientInterceptor.intercept_unary_stream"><code class="descname">intercept_unary_stream</code><span class="sig-paren">(</span><em>continuation</em>, <em>client_call_details</em>, <em>request</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>continuation</strong> – A function that proceeds with the invocation byexecuting the next interceptor in chain or invoking theactual RPC on the underlying Channel. It is the interceptor’sresponsibility 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 isboth a Call for the RPC and an iterator for response values.Drawing response values from the returned Call-iterator mayraise RpcError indicating termination of the RPC with non-OKstatus.</li><li><strong>client_call_details</strong> – A ClientCallDetails object describing theoutgoing RPC.</li><li><strong>request</strong> – The request value for the RPC.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and an iterator ofresponse values. Drawing response values from the returnedCall-iterator may raise RpcError indicating termination ofthe RPC with non-OK status.</p></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.StreamUnaryClientInterceptor"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.StreamUnaryClientInterceptor.intercept_stream_unary"><code class="descname">intercept_stream_unary</code><span class="sig-paren">(</span><em>continuation</em>, <em>client_call_details</em>, <em>request_iterator</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>continuation</strong> – A function that proceeds with the invocation byexecuting the next interceptor in chain or invoking theactual RPC on the underlying Channel. It is the interceptor’sresponsibility 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 isboth 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 messageof the RPC. Should the event terminate with non-OK status, thereturned Call-Future’s exception value will be an RpcError.</li><li><strong>client_call_details</strong> – A ClientCallDetails object describing theoutgoing RPC.</li><li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and a Future.In the event of RPC completion, the return Call-Future’sresult value will be the response message of the RPC.Should the event terminate with non-OK status, the returnedCall-Future’s exception value will be an RpcError.</p></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.StreamStreamClientInterceptor"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.StreamStreamClientInterceptor.intercept_stream_stream"><code class="descname">intercept_stream_stream</code><span class="sig-paren">(</span><em>continuation</em>, <em>client_call_details</em>, <em>request_iterator</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>continuation</strong> – A function that proceeds with the invocation byexecuting the next interceptor in chain or invoking theactual RPC on the underlying Channel. It is the interceptor’sresponsibility 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 isboth a Call for the RPC and an iterator for response values.Drawing response values from the returned Call-iterator mayraise RpcError indicating termination of the RPC with non-OKstatus.</li><li><strong>client_call_details</strong> – A ClientCallDetails object describing theoutgoing RPC.</li><li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and an iterator ofresponse values. Drawing response values from the returnedCall-iterator may raise RpcError indicating termination ofthe RPC with non-OK status.</p></td></tr></tbody></table></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="class"><dt id="grpc.ServicerContext"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.ServicerContext.abort"><code class="descname">abort</code><span class="sig-paren">(</span><em>code</em>, <em>details</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 existingones.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>code</strong> – A StatusCode object to be sent to the client.It must not be StatusCode.OK.</li><li><strong>details</strong> – An ASCII-encodable string to be sent to the client upontermination of the RPC.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code> – An exception is always raised to signal the abortion theRPC to the gRPC runtime.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.abort_with_status"><code class="descname">abort_with_status</code><span class="sig-paren">(</span><em>status</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>status</strong> – A grpc.Status object. The status code in it must not beStatusCode.OK.</td></tr><tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code> – An exception is always raised to signal the abortion theRPC to the gRPC runtime.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.auth_context"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A map of strings to an iterable of bytes for each auth property.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.invocation_metadata"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The invocation <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.peer"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A string identifying the peer that invoked the RPC being serviced.The string format is determined by gRPC runtime.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.peer_identities"><code class="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 toservicer_context.auth_context().get(servicer_context.peer_identity_key())</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">An iterable of the identities, or None if the call is notauthenticated. Each identity is returned as a raw bytes type.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.peer_identity_key"><code class="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” areused to identify an SSL peer.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The auth property (string) that indicates thepeer identity, or None if the call is not authenticated.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.send_initial_metadata"><code class="descname">send_initial_metadata</code><span class="sig-paren">(</span><em>initial_metadata</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 nometadata to add to what the gRPC runtime will transmit.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>initial_metadata</strong> – The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.set_code"><code class="descname">set_code</code><span class="sig-paren">(</span><em>code</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 wishthe gRPC runtime to determine the status code of the RPC.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>code</strong> – A StatusCode object to be sent to the client.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.set_details"><code class="descname">set_details</code><span class="sig-paren">(</span><em>details</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 haveno details to transmit.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>details</strong> – An ASCII-encodable string to be sent to the client upontermination of the RPC.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.ServicerContext.set_trailing_metadata"><code class="descname">set_trailing_metadata</code><span class="sig-paren">(</span><em>trailing_metadata</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>Sends the trailing metadata for the RPC.</p><p>This method need not be called by implementations if they have nometadata to add to what the gRPC runtime will transmit.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>trailing_metadata</strong> – The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</td></tr></tbody></table></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="class"><dt id="grpc.RpcMethodHandler"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="attribute"><dt id="grpc.RpcMethodHandler.request_streaming"><code class="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 messageor any arbitrary number of request messages.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.response_streaming"><code class="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 messageor any arbitrary number of response messages.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.request_deserializer"><code class="descname">request_deserializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_deserializer" title="Permalink to this definition">¶</a></dt><dd><p>A callable behavior that accepts a byte string andreturns an object suitable to be passed to this object’s businesslogic, or None to indicate that this object’s business logic should bepassed the raw request bytes.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.response_serializer"><code class="descname">response_serializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_serializer" title="Permalink to this definition">¶</a></dt><dd><p>A callable behavior that accepts an object producedby this object’s business logic and returns a byte string, or None toindicate that the byte strings produced by this object’s business logicshould be transmitted on the wire as they are.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.unary_unary"><code class="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 acallable value that takes a request value and a ServicerContext objectand returns a response value. Only non-None if both request_streamingand response_streaming are False.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.unary_stream"><code class="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 acallable value that takes a request value and a ServicerContext objectand returns an iterator of response values. Only non-None ifrequest_streaming is False and response_streaming is True.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.stream_unary"><code class="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 acallable value that takes an iterator of request values and aServicerContext object and returns a response value. Only non-None ifrequest_streaming is True and response_streaming is False.</p></dd></dl><dl class="attribute"><dt id="grpc.RpcMethodHandler.stream_stream"><code class="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 acallable value that takes an iterator of request values and aServicerContext object and returns an iterator of response values.Only non-None if request_streaming and response_streaming are bothTrue.</p></dd></dl></dd></dl><dl class="class"><dt id="grpc.HandlerCallDetails"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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... attribute:: method</p><blockquote><div>The method name of the RPC.</div></blockquote><dl class="attribute"><dt id="grpc.HandlerCallDetails.invocation_metadata"><code class="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="class"><dt id="grpc.GenericRpcHandler"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.GenericRpcHandler.service"><code class="descname">service</code><span class="sig-paren">(</span><em>handler_call_details</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>handler_call_details</strong> – A HandlerCallDetails describing the RPC.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">An RpcMethodHandler with which the RPC may be serviced if theimplementation chooses to service this RPC, or None otherwise.</td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.ServiceRpcHandler"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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 valuereturned by service_name(), and ‘Service.Method’ is the methodname.  A service can have multiple method names, but only a singleservice name.</p><dl class="method"><dt id="grpc.ServiceRpcHandler.service_name"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The service name.</td></tr></tbody></table></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="class"><dt id="grpc.ServerInterceptor"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.ServerInterceptor.intercept_service"><code class="descname">intercept_service</code><span class="sig-paren">(</span><em>continuation</em>, <em>handler_call_details</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>continuation</strong> – A function that takes a HandlerCallDetails andproceeds to invoke the next interceptor in the chain, if any,or the RPC handler lookup logic, with the call details passedas an argument, and returns an RpcMethodHandler instance ifthe RPC is considered serviced, or None otherwise.</li><li><strong>handler_call_details</strong> – A HandlerCallDetails describing the RPC.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An RpcMethodHandler with which the RPC may be serviced if theinterceptor chooses to service this RPC, or None otherwise.</p></td></tr></tbody></table></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="class"><dt id="grpc.UnaryUnaryMultiCallable"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.UnaryUnaryMultiCallable.__call__"><code class="descname">__call__</code><span class="sig-paren">(</span><em>request</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request</strong> – The request value for the RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allowfor the RPC.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The response value for the RPC.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RpcError</span></code></a> – Indicating that the RPC terminated with non-OK status. Theraised RpcError will also be a Call for the RPC affording the RPC’smetadata, status code, and details.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.UnaryUnaryMultiCallable.future"><code class="descname">future</code><span class="sig-paren">(</span><em>request</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request</strong> – The request value for the RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allow forthe RPC.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and a Future.In the event of RPC completion, the return Call-Future’s resultvalue 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></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.UnaryUnaryMultiCallable.with_call"><code class="descname">with_call</code><span class="sig-paren">(</span><em>request</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request</strong> – The request value for the RPC.</li><li><strong>timeout</strong> – An optional durating of time in seconds to allow forthe RPC.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The response value for the RPC and a Call value for the RPC.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RpcError</span></code></a> – Indicating that the RPC terminated with non-OK status. Theraised RpcError will also be a Call for the RPC affording the RPC’smetadata, status code, and details.</p></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.UnaryStreamMultiCallable"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.UnaryStreamMultiCallable.__call__"><code class="descname">__call__</code><span class="sig-paren">(</span><em>request</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request</strong> – The request value for the RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allow forthe RPC. If None, the timeout is considered infinite.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and an iterator ofresponse values. Drawing response values from the returnedCall-iterator may raise RpcError indicating termination of theRPC with non-OK status.</p></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.StreamUnaryMultiCallable"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.StreamUnaryMultiCallable.__call__"><code class="descname">__call__</code><span class="sig-paren">(</span><em>request_iterator</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request_iterator</strong> – An iterator that yields request values forthe RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allow forthe RPC. If None, the timeout is considered infinite.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The response value for the RPC.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RpcError</span></code></a> – Indicating that the RPC terminated with non-OK status. Theraised RpcError will also implement grpc.Call, affording methodssuch as metadata, code, and details.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.StreamUnaryMultiCallable.future"><code class="descname">future</code><span class="sig-paren">(</span><em>request_iterator</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allow forthe RPC. If None, the timeout is considered infinite.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">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 valuewill be the response message of the RPC. Should the event terminatewith non-OK status, the returned Call-Future’s exception value willbe an RpcError.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.StreamUnaryMultiCallable.with_call"><code class="descname">with_call</code><span class="sig-paren">(</span><em>request_iterator</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request_iterator</strong> – An iterator that yields request values forthe RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allow forthe RPC. If None, the timeout is considered infinite.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The response value for the RPC and a Call object for the RPC.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">RpcError</span></code></a> – Indicating that the RPC terminated with non-OK status. Theraised RpcError will also be a Call for the RPC affording the RPC’smetadata, status code, and details.</p></td></tr></tbody></table></dd></dl></dd></dl><dl class="class"><dt id="grpc.StreamStreamMultiCallable"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.StreamStreamMultiCallable.__call__"><code class="descname">__call__</code><span class="sig-paren">(</span><em>request_iterator</em>, <em>timeout=None</em>, <em>metadata=None</em>, <em>credentials=None</em>, <em>wait_for_ready=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"><li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li><li><strong>timeout</strong> – An optional duration of time in seconds to allow forthe RPC. If not specified, the timeout is considered infinite.</li><li><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 theservice-side of the RPC.</li><li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li><li><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optionalflag to enable wait for ready mechanism</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An object that is both a Call for the RPC and an iterator ofresponse values. Drawing response values from the returnedCall-iterator may raise RpcError indicating termination of theRPC with non-OK status.</p></td></tr></tbody></table></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="exception"><dt id="grpc.FutureTimeoutError"><em class="property">exception </em><code class="descclassname">grpc.</code><code class="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="exception"><dt id="grpc.FutureCancelledError"><em class="property">exception </em><code class="descclassname">grpc.</code><code class="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="class"><dt id="grpc.Future"><em class="property">class </em><code class="descclassname">grpc.</code><code class="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="method"><dt id="grpc.Future.add_done_callback"><code class="descname">add_done_callback</code><span class="sig-paren">(</span><em>fn</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 outcomeof the computation.  Callbacks will be invoked after the future isterimated, whether successfully or not.</p><p>If the computation has already completed, the callback will be calledimmediately.</p><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fn</strong> – A callable taking this Future object as its single parameter.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.cancel"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Returns True if the computation was canceled.<p>Returns False under all other circumstances, for example:</p><ol class="arabic simple"><li>computation has begun and could not be canceled.</li><li>computation has finished</li><li><dl class="first docutils"><dt>computation is scheduled for execution and it is impossible</dt><dd>to determine its state without blocking.</dd></dl></li></ol></td></tr><tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.cancelled"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Returns True if the computation was cancelled before its result becameavailable.<p>Returns False under all other circumstances, for example:</p><ol class="arabic simple"><li>computation was not cancelled.</li><li>computation’s result is available.</li></ol></td></tr><tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.done"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Returns True if the computation already executed or was cancelled.Returns False if the computation is scheduled for execution orcurrently executing.This is exactly opposite of the running() method’s result.</td></tr><tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.exception"><code class="descname">exception</code><span class="sig-paren">(</span><em>timeout=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> – The length of time in seconds to wait for the computation toterminate or be cancelled. If None, the call will block until thecomputations’s termination.</p></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The exception raised by the computation, or None if the computationdid not raise an exception.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple"><li><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FutureTimeoutError</span></code></a> – If a timeout value is passed and the computationdoes not terminate within the allotted time.</li><li><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FutureCancelledError</span></code></a> – If the computation was cancelled.</li></ul></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.result"><code class="descname">result</code><span class="sig-paren">(</span><em>timeout=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> – The length of time in seconds to wait for the computation tofinish or be cancelled. If None, the call will block until thecomputations’s termination.</p></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The return value of the computation.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple"><li><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FutureTimeoutError</span></code></a> – If a timeout value is passed and the computationdoes not terminate within the allotted time.</li><li><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FutureCancelledError</span></code></a> – If the computation was cancelled.</li><li><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code> – If the computation raised an exception, this call willraise the same exception.</li></ul></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.running"><code class="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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Returns True if the computation is scheduled for execution orcurrently executing.<p>Returns False if the computation already executed or was cancelled.</p></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.Future.traceback"><code class="descname">traceback</code><span class="sig-paren">(</span><em>timeout=None</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><table class="docutils field-list" frame="void" rules="none"><col class="field-name" /><col class="field-body" /><tbody valign="top"><tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>timeout</strong> – The length of time in seconds to wait for the computationto terminate or be cancelled. If None, the call will block untilthe computation’s termination.</p></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The traceback of the exception raised by the computation, or Noneif the computation did not raise an exception.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple"><li><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FutureTimeoutError</span></code></a> – If a timeout value is passed and the computationdoes not terminate within the allotted time.</li><li><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">FutureCancelledError</span></code></a> – If the computation was cancelled.</li></ul></td></tr></tbody></table></dd></dl></dd></dl></div></div></div>          </div>                  </div>      </div>    <div class="clearer"></div>  </div>    <div class="footer">      ©2018, 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>
 |