grpc.html 161 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>gRPC &#8212; gRPC Python 1.32.0 documentation</title>
  7. <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  10. <script src="_static/jquery.js"></script>
  11. <script src="_static/underscore.js"></script>
  12. <script src="_static/doctools.js"></script>
  13. <script src="_static/language_data.js"></script>
  14. <link rel="index" title="Index" href="genindex.html" />
  15. <link rel="search" title="Search" href="search.html" />
  16. <link rel="next" title="gRPC AsyncIO API" href="grpc_asyncio.html" />
  17. <link rel="prev" title="Welcome to gRPC Python’s documentation!" href="index.html" />
  18. <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  19. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
  20. </head><body>
  21. <div class="document">
  22. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  23. <div class="sphinxsidebarwrapper">
  24. <h1 class="logo"><a href="index.html">gRPC Python</a></h1>
  25. <p class="blurb">1.32.0</p>
  26. <h3>Navigation</h3>
  27. <p class="caption"><span class="caption-text">Contents:</span></p>
  28. <ul class="current">
  29. <li class="toctree-l1 current"><a class="current reference internal" href="#">gRPC</a><ul>
  30. <li class="toctree-l2"><a class="reference internal" href="#tutorial">Tutorial</a></li>
  31. <li class="toctree-l2"><a class="reference internal" href="#example">Example</a></li>
  32. <li class="toctree-l2"><a class="reference internal" href="#module-contents">Module Contents</a><ul>
  33. <li class="toctree-l3"><a class="reference internal" href="#version">Version</a></li>
  34. <li class="toctree-l3"><a class="reference internal" href="#create-client">Create Client</a></li>
  35. <li class="toctree-l3"><a class="reference internal" href="#create-client-credentials">Create Client Credentials</a></li>
  36. <li class="toctree-l3"><a class="reference internal" href="#create-server">Create Server</a></li>
  37. <li class="toctree-l3"><a class="reference internal" href="#create-server-credentials">Create Server Credentials</a></li>
  38. <li class="toctree-l3"><a class="reference internal" href="#local-connection-type">Local Connection Type</a></li>
  39. <li class="toctree-l3"><a class="reference internal" href="#rpc-method-handlers">RPC Method Handlers</a></li>
  40. <li class="toctree-l3"><a class="reference internal" href="#channel-ready-future">Channel Ready Future</a></li>
  41. <li class="toctree-l3"><a class="reference internal" href="#channel-connectivity">Channel Connectivity</a></li>
  42. <li class="toctree-l3"><a class="reference internal" href="#grpc-status-code">gRPC Status Code</a></li>
  43. <li class="toctree-l3"><a class="reference internal" href="#channel-object">Channel Object</a></li>
  44. <li class="toctree-l3"><a class="reference internal" href="#server-object">Server Object</a></li>
  45. <li class="toctree-l3"><a class="reference internal" href="#authentication-authorization-objects">Authentication &amp; Authorization Objects</a></li>
  46. <li class="toctree-l3"><a class="reference internal" href="#grpc-exceptions">gRPC Exceptions</a></li>
  47. <li class="toctree-l3"><a class="reference internal" href="#shared-context">Shared Context</a></li>
  48. <li class="toctree-l3"><a class="reference internal" href="#client-side-context">Client-Side Context</a></li>
  49. <li class="toctree-l3"><a class="reference internal" href="#client-side-interceptor">Client-Side Interceptor</a></li>
  50. <li class="toctree-l3"><a class="reference internal" href="#service-side-context">Service-Side Context</a></li>
  51. <li class="toctree-l3"><a class="reference internal" href="#service-side-handler">Service-Side Handler</a></li>
  52. <li class="toctree-l3"><a class="reference internal" href="#service-side-interceptor">Service-Side Interceptor</a></li>
  53. <li class="toctree-l3"><a class="reference internal" href="#multi-callable-interfaces">Multi-Callable Interfaces</a></li>
  54. <li class="toctree-l3"><a class="reference internal" href="#future-interfaces">Future Interfaces</a></li>
  55. <li class="toctree-l3"><a class="reference internal" href="#compression">Compression</a></li>
  56. <li class="toctree-l3"><a class="reference internal" href="#runtime-protobuf-parsing">Runtime Protobuf Parsing</a></li>
  57. </ul>
  58. </li>
  59. </ul>
  60. </li>
  61. <li class="toctree-l1"><a class="reference internal" href="grpc_asyncio.html">gRPC AsyncIO API</a></li>
  62. <li class="toctree-l1"><a class="reference internal" href="grpc_channelz.html">gRPC Channelz</a></li>
  63. <li class="toctree-l1"><a class="reference internal" href="grpc_health_checking.html">gRPC Health Checking</a></li>
  64. <li class="toctree-l1"><a class="reference internal" href="grpc_reflection.html">gRPC Reflection</a></li>
  65. <li class="toctree-l1"><a class="reference internal" href="grpc_status.html">gRPC Status</a></li>
  66. <li class="toctree-l1"><a class="reference internal" href="grpc_testing.html">gRPC Testing</a></li>
  67. <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
  68. </ul>
  69. <div class="relations">
  70. <h3>Related Topics</h3>
  71. <ul>
  72. <li><a href="index.html">Documentation overview</a><ul>
  73. <li>Previous: <a href="index.html" title="previous chapter">Welcome to gRPC Python’s documentation!</a></li>
  74. <li>Next: <a href="grpc_asyncio.html" title="next chapter">gRPC AsyncIO API</a></li>
  75. </ul></li>
  76. </ul>
  77. </div>
  78. <div id="searchbox" style="display: none" role="search">
  79. <h3 id="searchlabel">Quick search</h3>
  80. <div class="searchformwrapper">
  81. <form class="search" action="search.html" method="get">
  82. <input type="text" name="q" aria-labelledby="searchlabel" />
  83. <input type="submit" value="Go" />
  84. </form>
  85. </div>
  86. </div>
  87. <script>$('#searchbox').show(0);</script>
  88. </div>
  89. </div>
  90. <div class="documentwrapper">
  91. <div class="bodywrapper">
  92. <div class="body" role="main">
  93. <div class="section" id="module-grpc">
  94. <span id="grpc"></span><h1>gRPC<a class="headerlink" href="#module-grpc" title="Permalink to this headline">¶</a></h1>
  95. <div class="section" id="tutorial">
  96. <h2>Tutorial<a class="headerlink" href="#tutorial" title="Permalink to this headline">¶</a></h2>
  97. <p>If you want to see gRPC in action first, visit the <a class="reference external" href="https://grpc.io/docs/languages/python/quickstart">Python Quickstart</a>.
  98. Or, if you would like dive in with more extensive usage of gRPC Python, check <a class="reference external" href="https://grpc.io/docs/languages/python/basics">gRPC Basics - Python</a> out.</p>
  99. </div>
  100. <div class="section" id="example">
  101. <h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
  102. <p>Go to <a class="reference external" href="https://github.com/grpc/grpc/tree/master/examples/python">gRPC Python Examples</a></p>
  103. </div>
  104. <div class="section" id="module-contents">
  105. <h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2>
  106. <div class="section" id="version">
  107. <h3>Version<a class="headerlink" href="#version" title="Permalink to this headline">¶</a></h3>
  108. <p>The version string is available as <code class="code docutils literal notranslate"><span class="pre">grpc.__version__</span></code>.</p>
  109. </div>
  110. <div class="section" id="create-client">
  111. <h3>Create Client<a class="headerlink" href="#create-client" title="Permalink to this headline">¶</a></h3>
  112. <dl class="py function">
  113. <dt id="grpc.insecure_channel">
  114. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">insecure_channel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">target</span></em>, <em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#insecure_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.insecure_channel" title="Permalink to this definition">¶</a></dt>
  115. <dd><p>Creates an insecure Channel to a server.</p>
  116. <p>The returned Channel is thread-safe.</p>
  117. <dl class="field-list simple">
  118. <dt class="field-odd">Parameters</dt>
  119. <dd class="field-odd"><ul class="simple">
  120. <li><p><strong>target</strong> – The server address</p></li>
  121. <li><p><strong>options</strong> – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a>
  122. in gRPC Core runtime) to configure the channel.</p></li>
  123. <li><p><strong>compression</strong> – An optional value indicating the compression method to be
  124. used over the lifetime of the channel. This is an EXPERIMENTAL option.</p></li>
  125. </ul>
  126. </dd>
  127. <dt class="field-even">Returns</dt>
  128. <dd class="field-even"><p>A Channel.</p>
  129. </dd>
  130. </dl>
  131. </dd></dl>
  132. <dl class="py function">
  133. <dt id="grpc.secure_channel">
  134. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">secure_channel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">target</span></em>, <em class="sig-param"><span class="n">credentials</span></em>, <em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#secure_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.secure_channel" title="Permalink to this definition">¶</a></dt>
  135. <dd><p>Creates a secure Channel to a server.</p>
  136. <p>The returned Channel is thread-safe.</p>
  137. <dl class="field-list simple">
  138. <dt class="field-odd">Parameters</dt>
  139. <dd class="field-odd"><ul class="simple">
  140. <li><p><strong>target</strong> – The server address.</p></li>
  141. <li><p><strong>credentials</strong> – A ChannelCredentials instance.</p></li>
  142. <li><p><strong>options</strong> – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a>
  143. in gRPC Core runtime) to configure the channel.</p></li>
  144. <li><p><strong>compression</strong> – An optional value indicating the compression method to be
  145. used over the lifetime of the channel. This is an EXPERIMENTAL option.</p></li>
  146. </ul>
  147. </dd>
  148. <dt class="field-even">Returns</dt>
  149. <dd class="field-even"><p>A Channel.</p>
  150. </dd>
  151. </dl>
  152. </dd></dl>
  153. <dl class="py function">
  154. <dt id="grpc.intercept_channel">
  155. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">intercept_channel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">interceptors</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#intercept_channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.intercept_channel" title="Permalink to this definition">¶</a></dt>
  156. <dd><p>Intercepts a channel through a set of interceptors.</p>
  157. <p>This is an EXPERIMENTAL API.</p>
  158. <dl class="field-list simple">
  159. <dt class="field-odd">Parameters</dt>
  160. <dd class="field-odd"><ul class="simple">
  161. <li><p><strong>channel</strong> – A Channel.</p></li>
  162. <li><p><strong>interceptors</strong> – Zero or more objects of type
  163. UnaryUnaryClientInterceptor,
  164. UnaryStreamClientInterceptor,
  165. StreamUnaryClientInterceptor, or
  166. StreamStreamClientInterceptor.
  167. Interceptors are given control in the order they are listed.</p></li>
  168. </ul>
  169. </dd>
  170. <dt class="field-even">Returns</dt>
  171. <dd class="field-even"><p>A Channel that intercepts each invocation via the provided interceptors.</p>
  172. </dd>
  173. <dt class="field-odd">Raises</dt>
  174. <dd class="field-odd"><p><strong>TypeError</strong> – If interceptor does not derive from any of
  175. UnaryUnaryClientInterceptor,
  176. UnaryStreamClientInterceptor,
  177. StreamUnaryClientInterceptor, or
  178. StreamStreamClientInterceptor.</p>
  179. </dd>
  180. </dl>
  181. </dd></dl>
  182. </div>
  183. <div class="section" id="create-client-credentials">
  184. <h3>Create Client Credentials<a class="headerlink" href="#create-client-credentials" title="Permalink to this headline">¶</a></h3>
  185. <dl class="py function">
  186. <dt id="grpc.ssl_channel_credentials">
  187. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ssl_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">root_certificates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">private_key</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">certificate_chain</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ssl_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ssl_channel_credentials" title="Permalink to this definition">¶</a></dt>
  188. <dd><p>Creates a ChannelCredentials for use with an SSL-enabled Channel.</p>
  189. <dl class="field-list simple">
  190. <dt class="field-odd">Parameters</dt>
  191. <dd class="field-odd"><ul class="simple">
  192. <li><p><strong>root_certificates</strong> – The PEM-encoded root certificates as a byte string,
  193. or None to retrieve them from a default location chosen by gRPC
  194. runtime.</p></li>
  195. <li><p><strong>private_key</strong> – The PEM-encoded private key as a byte string, or None if no
  196. private key should be used.</p></li>
  197. <li><p><strong>certificate_chain</strong> – The PEM-encoded certificate chain as a byte string
  198. to use or None if no certificate chain should be used.</p></li>
  199. </ul>
  200. </dd>
  201. <dt class="field-even">Returns</dt>
  202. <dd class="field-even"><p>A ChannelCredentials for use with an SSL-enabled Channel.</p>
  203. </dd>
  204. </dl>
  205. </dd></dl>
  206. <dl class="py function">
  207. <dt id="grpc.metadata_call_credentials">
  208. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">metadata_call_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">metadata_plugin</span></em>, <em class="sig-param"><span class="n">name</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#metadata_call_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.metadata_call_credentials" title="Permalink to this definition">¶</a></dt>
  209. <dd><p>Construct CallCredentials from an AuthMetadataPlugin.</p>
  210. <dl class="field-list simple">
  211. <dt class="field-odd">Parameters</dt>
  212. <dd class="field-odd"><ul class="simple">
  213. <li><p><strong>metadata_plugin</strong> – An AuthMetadataPlugin to use for authentication.</p></li>
  214. <li><p><strong>name</strong> – An optional name for the plugin.</p></li>
  215. </ul>
  216. </dd>
  217. <dt class="field-even">Returns</dt>
  218. <dd class="field-even"><p>A CallCredentials.</p>
  219. </dd>
  220. </dl>
  221. </dd></dl>
  222. <dl class="py function">
  223. <dt id="grpc.access_token_call_credentials">
  224. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">access_token_call_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">access_token</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#access_token_call_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.access_token_call_credentials" title="Permalink to this definition">¶</a></dt>
  225. <dd><p>Construct CallCredentials from an access token.</p>
  226. <dl class="field-list simple">
  227. <dt class="field-odd">Parameters</dt>
  228. <dd class="field-odd"><p><strong>access_token</strong> – A string to place directly in the http request
  229. authorization header, for example
  230. “authorization: Bearer &lt;access_token&gt;”.</p>
  231. </dd>
  232. <dt class="field-even">Returns</dt>
  233. <dd class="field-even"><p>A CallCredentials.</p>
  234. </dd>
  235. </dl>
  236. </dd></dl>
  237. <dl class="py function">
  238. <dt id="grpc.composite_call_credentials">
  239. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">composite_call_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">call_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#composite_call_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.composite_call_credentials" title="Permalink to this definition">¶</a></dt>
  240. <dd><p>Compose multiple CallCredentials to make a new CallCredentials.</p>
  241. <dl class="field-list simple">
  242. <dt class="field-odd">Parameters</dt>
  243. <dd class="field-odd"><p><strong>*call_credentials</strong> – At least two CallCredentials objects.</p>
  244. </dd>
  245. <dt class="field-even">Returns</dt>
  246. <dd class="field-even"><p>A CallCredentials object composed of the given CallCredentials objects.</p>
  247. </dd>
  248. </dl>
  249. </dd></dl>
  250. <dl class="py function">
  251. <dt id="grpc.composite_channel_credentials">
  252. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">composite_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel_credentials</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">call_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#composite_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.composite_channel_credentials" title="Permalink to this definition">¶</a></dt>
  253. <dd><p>Compose a ChannelCredentials and one or more CallCredentials objects.</p>
  254. <dl class="field-list simple">
  255. <dt class="field-odd">Parameters</dt>
  256. <dd class="field-odd"><ul class="simple">
  257. <li><p><strong>channel_credentials</strong> – A ChannelCredentials object.</p></li>
  258. <li><p><strong>*call_credentials</strong> – One or more CallCredentials objects.</p></li>
  259. </ul>
  260. </dd>
  261. <dt class="field-even">Returns</dt>
  262. <dd class="field-even"><p><dl class="simple">
  263. <dt>A ChannelCredentials composed of the given ChannelCredentials and</dt><dd><p>CallCredentials objects.</p>
  264. </dd>
  265. </dl>
  266. </p>
  267. </dd>
  268. </dl>
  269. </dd></dl>
  270. <dl class="py function">
  271. <dt id="grpc.local_channel_credentials">
  272. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">local_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">local_connect_type</span><span class="o">=</span><span class="default_value">grpc.LocalConnectionType.LOCAL_TCP</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#local_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.local_channel_credentials" title="Permalink to this definition">¶</a></dt>
  273. <dd><p>Creates a local ChannelCredentials used for local connections.</p>
  274. <p>This is an EXPERIMENTAL API.</p>
  275. <p>Local credentials are used by local TCP endpoints (e.g. localhost:10000)
  276. also UDS connections.</p>
  277. <p>The connections created by local channel credentials are not
  278. encrypted, but will be checked if they are local or not.
  279. The UDS connections are considered secure by providing peer authentication
  280. and data confidentiality while TCP connections are considered insecure.</p>
  281. <p>It is allowed to transmit call credentials over connections created by
  282. local channel credentials.</p>
  283. <p>Local channel credentials are useful for 1) eliminating insecure_channel usage;
  284. 2) enable unit testing for call credentials without setting up secrets.</p>
  285. <dl class="field-list simple">
  286. <dt class="field-odd">Parameters</dt>
  287. <dd class="field-odd"><p><strong>local_connect_type</strong> – Local connection type (either
  288. grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP)</p>
  289. </dd>
  290. <dt class="field-even">Returns</dt>
  291. <dd class="field-even"><p>A ChannelCredentials for use with a local Channel</p>
  292. </dd>
  293. </dl>
  294. </dd></dl>
  295. <dl class="py function">
  296. <dt id="grpc.compute_engine_channel_credentials">
  297. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">compute_engine_channel_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">call_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#compute_engine_channel_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.compute_engine_channel_credentials" title="Permalink to this definition">¶</a></dt>
  298. <dd><p>Creates a compute engine channel credential.</p>
  299. <p>This credential can only be used in a GCP environment as it relies on
  300. a handshaker service. For more info about ALTS, see
  301. <a class="reference external" href="https://cloud.google.com/security/encryption-in-transit/application-layer-transport-security">https://cloud.google.com/security/encryption-in-transit/application-layer-transport-security</a></p>
  302. <p>This channel credential is expected to be used as part of a composite
  303. credential in conjunction with a call credentials that authenticates the
  304. VM’s default service account. If used with any other sort of call
  305. credential, the connection may suddenly and unexpectedly begin failing RPCs.</p>
  306. </dd></dl>
  307. </div>
  308. <div class="section" id="create-server">
  309. <h3>Create Server<a class="headerlink" href="#create-server" title="Permalink to this headline">¶</a></h3>
  310. <dl class="py function">
  311. <dt id="grpc.server">
  312. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">server</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">thread_pool</span></em>, <em class="sig-param"><span class="n">handlers</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">interceptors</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">maximum_concurrent_rpcs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#server"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.server" title="Permalink to this definition">¶</a></dt>
  313. <dd><p>Creates a Server with which RPCs can be serviced.</p>
  314. <dl class="field-list simple">
  315. <dt class="field-odd">Parameters</dt>
  316. <dd class="field-odd"><ul class="simple">
  317. <li><p><strong>thread_pool</strong> – A futures.ThreadPoolExecutor to be used by the Server
  318. to execute RPC handlers.</p></li>
  319. <li><p><strong>handlers</strong> – An optional list of GenericRpcHandlers used for executing RPCs.
  320. More handlers may be added by calling add_generic_rpc_handlers any time
  321. before the server is started.</p></li>
  322. <li><p><strong>interceptors</strong> – An optional list of ServerInterceptor objects that observe
  323. and optionally manipulate the incoming RPCs before handing them over to
  324. handlers. The interceptors are given control in the order they are
  325. specified. This is an EXPERIMENTAL API.</p></li>
  326. <li><p><strong>options</strong> – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a> in gRPC runtime)
  327. to configure the channel.</p></li>
  328. <li><p><strong>maximum_concurrent_rpcs</strong> – The maximum number of concurrent RPCs this server
  329. will service before returning RESOURCE_EXHAUSTED status, or None to
  330. indicate no limit.</p></li>
  331. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  332. grpc.compression.Gzip. This compression algorithm will be used for the
  333. lifetime of the server unless overridden. This is an EXPERIMENTAL option.</p></li>
  334. </ul>
  335. </dd>
  336. <dt class="field-even">Returns</dt>
  337. <dd class="field-even"><p>A Server object.</p>
  338. </dd>
  339. </dl>
  340. </dd></dl>
  341. </div>
  342. <div class="section" id="create-server-credentials">
  343. <h3>Create Server Credentials<a class="headerlink" href="#create-server-credentials" title="Permalink to this headline">¶</a></h3>
  344. <dl class="py function">
  345. <dt id="grpc.ssl_server_credentials">
  346. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ssl_server_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">private_key_certificate_chain_pairs</span></em>, <em class="sig-param"><span class="n">root_certificates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">require_client_auth</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ssl_server_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ssl_server_credentials" title="Permalink to this definition">¶</a></dt>
  347. <dd><p>Creates a ServerCredentials for use with an SSL-enabled Server.</p>
  348. <dl class="field-list simple">
  349. <dt class="field-odd">Parameters</dt>
  350. <dd class="field-odd"><ul class="simple">
  351. <li><p><strong>private_key_certificate_chain_pairs</strong> – A list of pairs of the form
  352. [PEM-encoded private key, PEM-encoded certificate chain].</p></li>
  353. <li><p><strong>root_certificates</strong> – An optional byte string of PEM-encoded client root
  354. certificates that the server will use to verify client authentication.
  355. If omitted, require_client_auth must also be False.</p></li>
  356. <li><p><strong>require_client_auth</strong> – A boolean indicating whether or not to require
  357. clients to be authenticated. May only be True if root_certificates
  358. is not None.</p></li>
  359. </ul>
  360. </dd>
  361. <dt class="field-even">Returns</dt>
  362. <dd class="field-even"><p>A ServerCredentials for use with an SSL-enabled Server. Typically, this
  363. object is an argument to add_secure_port() method during server setup.</p>
  364. </dd>
  365. </dl>
  366. </dd></dl>
  367. <dl class="py function">
  368. <dt id="grpc.ssl_server_certificate_configuration">
  369. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ssl_server_certificate_configuration</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">private_key_certificate_chain_pairs</span></em>, <em class="sig-param"><span class="n">root_certificates</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ssl_server_certificate_configuration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ssl_server_certificate_configuration" title="Permalink to this definition">¶</a></dt>
  370. <dd><p>Creates a ServerCertificateConfiguration for use with a Server.</p>
  371. <dl class="field-list simple">
  372. <dt class="field-odd">Parameters</dt>
  373. <dd class="field-odd"><ul class="simple">
  374. <li><p><strong>private_key_certificate_chain_pairs</strong> – A collection of pairs of
  375. the form [PEM-encoded private key, PEM-encoded certificate
  376. chain].</p></li>
  377. <li><p><strong>root_certificates</strong> – An optional byte string of PEM-encoded client root
  378. certificates that the server will use to verify client authentication.</p></li>
  379. </ul>
  380. </dd>
  381. <dt class="field-even">Returns</dt>
  382. <dd class="field-even"><p><dl class="simple">
  383. <dt>A ServerCertificateConfiguration that can be returned in the certificate</dt><dd><p>configuration fetching callback.</p>
  384. </dd>
  385. </dl>
  386. </p>
  387. </dd>
  388. </dl>
  389. </dd></dl>
  390. <dl class="py function">
  391. <dt id="grpc.dynamic_ssl_server_credentials">
  392. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">dynamic_ssl_server_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">initial_certificate_configuration</span></em>, <em class="sig-param"><span class="n">certificate_configuration_fetcher</span></em>, <em class="sig-param"><span class="n">require_client_authentication</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#dynamic_ssl_server_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.dynamic_ssl_server_credentials" title="Permalink to this definition">¶</a></dt>
  393. <dd><p>Creates a ServerCredentials for use with an SSL-enabled Server.</p>
  394. <dl class="field-list simple">
  395. <dt class="field-odd">Parameters</dt>
  396. <dd class="field-odd"><ul class="simple">
  397. <li><p><strong>initial_certificate_configuration</strong> (<a class="reference internal" href="#grpc.ServerCertificateConfiguration" title="grpc.ServerCertificateConfiguration"><em>ServerCertificateConfiguration</em></a>) – The
  398. certificate configuration with which the server will be initialized.</p></li>
  399. <li><p><strong>certificate_configuration_fetcher</strong> (<em>callable</em>) – A callable that takes no
  400. arguments and should return a ServerCertificateConfiguration to
  401. replace the server’s current certificate, or None for no change
  402. (i.e., the server will continue its current certificate
  403. config). The library will call this callback on <em>every</em> new
  404. client connection before starting the TLS handshake with the
  405. client, thus allowing the user application to optionally
  406. return a new ServerCertificateConfiguration that the server will then
  407. use for the handshake.</p></li>
  408. <li><p><strong>require_client_authentication</strong> – A boolean indicating whether or not to
  409. require clients to be authenticated.</p></li>
  410. </ul>
  411. </dd>
  412. <dt class="field-even">Returns</dt>
  413. <dd class="field-even"><p>A ServerCredentials.</p>
  414. </dd>
  415. </dl>
  416. </dd></dl>
  417. <dl class="py function">
  418. <dt id="grpc.local_server_credentials">
  419. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">local_server_credentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">local_connect_type</span><span class="o">=</span><span class="default_value">grpc.LocalConnectionType.LOCAL_TCP</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#local_server_credentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.local_server_credentials" title="Permalink to this definition">¶</a></dt>
  420. <dd><p>Creates a local ServerCredentials used for local connections.</p>
  421. <p>This is an EXPERIMENTAL API.</p>
  422. <p>Local credentials are used by local TCP endpoints (e.g. localhost:10000)
  423. also UDS connections.</p>
  424. <p>The connections created by local server credentials are not
  425. encrypted, but will be checked if they are local or not.
  426. The UDS connections are considered secure by providing peer authentication
  427. and data confidentiality while TCP connections are considered insecure.</p>
  428. <p>It is allowed to transmit call credentials over connections created by local
  429. server credentials.</p>
  430. <p>Local server credentials are useful for 1) eliminating insecure_channel usage;
  431. 2) enable unit testing for call credentials without setting up secrets.</p>
  432. <dl class="field-list simple">
  433. <dt class="field-odd">Parameters</dt>
  434. <dd class="field-odd"><p><strong>local_connect_type</strong> – Local connection type (either
  435. grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP)</p>
  436. </dd>
  437. <dt class="field-even">Returns</dt>
  438. <dd class="field-even"><p>A ServerCredentials for use with a local Server</p>
  439. </dd>
  440. </dl>
  441. </dd></dl>
  442. </div>
  443. <div class="section" id="local-connection-type">
  444. <h3>Local Connection Type<a class="headerlink" href="#local-connection-type" title="Permalink to this headline">¶</a></h3>
  445. <dl class="py class">
  446. <dt id="grpc.LocalConnectionType">
  447. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">LocalConnectionType</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#LocalConnectionType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.LocalConnectionType" title="Permalink to this definition">¶</a></dt>
  448. <dd><p>Types of local connection for local credential creation.</p>
  449. <dl class="py attribute">
  450. <dt id="grpc.LocalConnectionType.UDS">
  451. <code class="sig-name descname">UDS</code><a class="headerlink" href="#grpc.LocalConnectionType.UDS" title="Permalink to this definition">¶</a></dt>
  452. <dd><p>Unix domain socket connections</p>
  453. </dd></dl>
  454. <dl class="py attribute">
  455. <dt id="grpc.LocalConnectionType.LOCAL_TCP">
  456. <code class="sig-name descname">LOCAL_TCP</code><a class="headerlink" href="#grpc.LocalConnectionType.LOCAL_TCP" title="Permalink to this definition">¶</a></dt>
  457. <dd><p>Local TCP connections.</p>
  458. </dd></dl>
  459. </dd></dl>
  460. </div>
  461. <div class="section" id="rpc-method-handlers">
  462. <h3>RPC Method Handlers<a class="headerlink" href="#rpc-method-handlers" title="Permalink to this headline">¶</a></h3>
  463. <dl class="py function">
  464. <dt id="grpc.unary_unary_rpc_method_handler">
  465. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">unary_unary_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#unary_unary_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.unary_unary_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
  466. <dd><p>Creates an RpcMethodHandler for a unary-unary RPC method.</p>
  467. <dl class="field-list simple">
  468. <dt class="field-odd">Parameters</dt>
  469. <dd class="field-odd"><ul class="simple">
  470. <li><p><strong>behavior</strong> – The implementation of an RPC that accepts one request
  471. and returns one response.</p></li>
  472. <li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
  473. <li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
  474. </ul>
  475. </dd>
  476. <dt class="field-even">Returns</dt>
  477. <dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
  478. </dd>
  479. </dl>
  480. </dd></dl>
  481. <dl class="py function">
  482. <dt id="grpc.unary_stream_rpc_method_handler">
  483. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">unary_stream_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#unary_stream_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.unary_stream_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
  484. <dd><p>Creates an RpcMethodHandler for a unary-stream RPC method.</p>
  485. <dl class="field-list simple">
  486. <dt class="field-odd">Parameters</dt>
  487. <dd class="field-odd"><ul class="simple">
  488. <li><p><strong>behavior</strong> – The implementation of an RPC that accepts one request
  489. and returns an iterator of response values.</p></li>
  490. <li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
  491. <li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
  492. </ul>
  493. </dd>
  494. <dt class="field-even">Returns</dt>
  495. <dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
  496. </dd>
  497. </dl>
  498. </dd></dl>
  499. <dl class="py function">
  500. <dt id="grpc.stream_unary_rpc_method_handler">
  501. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">stream_unary_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#stream_unary_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.stream_unary_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
  502. <dd><p>Creates an RpcMethodHandler for a stream-unary RPC method.</p>
  503. <dl class="field-list simple">
  504. <dt class="field-odd">Parameters</dt>
  505. <dd class="field-odd"><ul class="simple">
  506. <li><p><strong>behavior</strong> – The implementation of an RPC that accepts an iterator of
  507. request values and returns a single response value.</p></li>
  508. <li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
  509. <li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
  510. </ul>
  511. </dd>
  512. <dt class="field-even">Returns</dt>
  513. <dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
  514. </dd>
  515. </dl>
  516. </dd></dl>
  517. <dl class="py function">
  518. <dt id="grpc.stream_stream_rpc_method_handler">
  519. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">stream_stream_rpc_method_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">behavior</span></em>, <em class="sig-param"><span class="n">request_deserializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_serializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#stream_stream_rpc_method_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.stream_stream_rpc_method_handler" title="Permalink to this definition">¶</a></dt>
  520. <dd><p>Creates an RpcMethodHandler for a stream-stream RPC method.</p>
  521. <dl class="field-list simple">
  522. <dt class="field-odd">Parameters</dt>
  523. <dd class="field-odd"><ul class="simple">
  524. <li><p><strong>behavior</strong> – The implementation of an RPC that accepts an iterator of
  525. request values and returns an iterator of response values.</p></li>
  526. <li><p><strong>request_deserializer</strong> – An optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for request deserialization.</p></li>
  527. <li><p><strong>response_serializer</strong> – An optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for response serialization.</p></li>
  528. </ul>
  529. </dd>
  530. <dt class="field-even">Returns</dt>
  531. <dd class="field-even"><p>An RpcMethodHandler object that is typically used by grpc.Server.</p>
  532. </dd>
  533. </dl>
  534. </dd></dl>
  535. <dl class="py function">
  536. <dt id="grpc.method_handlers_generic_handler">
  537. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">method_handlers_generic_handler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">service</span></em>, <em class="sig-param"><span class="n">method_handlers</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#method_handlers_generic_handler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.method_handlers_generic_handler" title="Permalink to this definition">¶</a></dt>
  538. <dd><p>Creates a GenericRpcHandler from RpcMethodHandlers.</p>
  539. <dl class="field-list simple">
  540. <dt class="field-odd">Parameters</dt>
  541. <dd class="field-odd"><ul class="simple">
  542. <li><p><strong>service</strong> – The name of the service that is implemented by the
  543. method_handlers.</p></li>
  544. <li><p><strong>method_handlers</strong> – A dictionary that maps method names to corresponding
  545. RpcMethodHandler.</p></li>
  546. </ul>
  547. </dd>
  548. <dt class="field-even">Returns</dt>
  549. <dd class="field-even"><p>A GenericRpcHandler. This is typically added to the grpc.Server object
  550. with add_generic_rpc_handlers() before starting the server.</p>
  551. </dd>
  552. </dl>
  553. </dd></dl>
  554. </div>
  555. <div class="section" id="channel-ready-future">
  556. <h3>Channel Ready Future<a class="headerlink" href="#channel-ready-future" title="Permalink to this headline">¶</a></h3>
  557. <dl class="py function">
  558. <dt id="grpc.channel_ready_future">
  559. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">channel_ready_future</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">channel</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#channel_ready_future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.channel_ready_future" title="Permalink to this definition">¶</a></dt>
  560. <dd><p>Creates a Future that tracks when a Channel is ready.</p>
  561. <p>Cancelling the Future does not affect the channel’s state machine.
  562. It merely decouples the Future from channel state machine.</p>
  563. <dl class="field-list simple">
  564. <dt class="field-odd">Parameters</dt>
  565. <dd class="field-odd"><p><strong>channel</strong> – A Channel object.</p>
  566. </dd>
  567. <dt class="field-even">Returns</dt>
  568. <dd class="field-even"><p>A Future object that matures when the channel connectivity is
  569. ChannelConnectivity.READY.</p>
  570. </dd>
  571. </dl>
  572. </dd></dl>
  573. </div>
  574. <div class="section" id="channel-connectivity">
  575. <h3>Channel Connectivity<a class="headerlink" href="#channel-connectivity" title="Permalink to this headline">¶</a></h3>
  576. <dl class="py class">
  577. <dt id="grpc.ChannelConnectivity">
  578. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ChannelConnectivity</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ChannelConnectivity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ChannelConnectivity" title="Permalink to this definition">¶</a></dt>
  579. <dd><p>Mirrors grpc_connectivity_state in the gRPC Core.</p>
  580. <dl class="py attribute">
  581. <dt id="grpc.ChannelConnectivity.IDLE">
  582. <code class="sig-name descname">IDLE</code><a class="headerlink" href="#grpc.ChannelConnectivity.IDLE" title="Permalink to this definition">¶</a></dt>
  583. <dd><p>The channel is idle.</p>
  584. </dd></dl>
  585. <dl class="py attribute">
  586. <dt id="grpc.ChannelConnectivity.CONNECTING">
  587. <code class="sig-name descname">CONNECTING</code><a class="headerlink" href="#grpc.ChannelConnectivity.CONNECTING" title="Permalink to this definition">¶</a></dt>
  588. <dd><p>The channel is connecting.</p>
  589. </dd></dl>
  590. <dl class="py attribute">
  591. <dt id="grpc.ChannelConnectivity.READY">
  592. <code class="sig-name descname">READY</code><a class="headerlink" href="#grpc.ChannelConnectivity.READY" title="Permalink to this definition">¶</a></dt>
  593. <dd><p>The channel is ready to conduct RPCs.</p>
  594. </dd></dl>
  595. <dl class="py attribute">
  596. <dt id="grpc.ChannelConnectivity.TRANSIENT_FAILURE">
  597. <code class="sig-name descname">TRANSIENT_FAILURE</code><a class="headerlink" href="#grpc.ChannelConnectivity.TRANSIENT_FAILURE" title="Permalink to this definition">¶</a></dt>
  598. <dd><p>The channel has seen a failure from which it expects
  599. to recover.</p>
  600. </dd></dl>
  601. <dl class="py attribute">
  602. <dt id="grpc.ChannelConnectivity.SHUTDOWN">
  603. <code class="sig-name descname">SHUTDOWN</code><a class="headerlink" href="#grpc.ChannelConnectivity.SHUTDOWN" title="Permalink to this definition">¶</a></dt>
  604. <dd><p>The channel has seen a failure from which it cannot recover.</p>
  605. </dd></dl>
  606. </dd></dl>
  607. </div>
  608. <div class="section" id="grpc-status-code">
  609. <h3>gRPC Status Code<a class="headerlink" href="#grpc-status-code" title="Permalink to this headline">¶</a></h3>
  610. <dl class="py class">
  611. <dt id="grpc.StatusCode">
  612. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StatusCode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StatusCode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StatusCode" title="Permalink to this definition">¶</a></dt>
  613. <dd><p>Mirrors grpc_status_code in the gRPC Core.</p>
  614. <dl class="py attribute">
  615. <dt id="grpc.StatusCode.OK">
  616. <code class="sig-name descname">OK</code><a class="headerlink" href="#grpc.StatusCode.OK" title="Permalink to this definition">¶</a></dt>
  617. <dd><p>Not an error; returned on success</p>
  618. </dd></dl>
  619. <dl class="py attribute">
  620. <dt id="grpc.StatusCode.CANCELLED">
  621. <code class="sig-name descname">CANCELLED</code><a class="headerlink" href="#grpc.StatusCode.CANCELLED" title="Permalink to this definition">¶</a></dt>
  622. <dd><p>The operation was cancelled (typically by the caller).</p>
  623. </dd></dl>
  624. <dl class="py attribute">
  625. <dt id="grpc.StatusCode.UNKNOWN">
  626. <code class="sig-name descname">UNKNOWN</code><a class="headerlink" href="#grpc.StatusCode.UNKNOWN" title="Permalink to this definition">¶</a></dt>
  627. <dd><p>Unknown error.</p>
  628. </dd></dl>
  629. <dl class="py attribute">
  630. <dt id="grpc.StatusCode.INVALID_ARGUMENT">
  631. <code class="sig-name descname">INVALID_ARGUMENT</code><a class="headerlink" href="#grpc.StatusCode.INVALID_ARGUMENT" title="Permalink to this definition">¶</a></dt>
  632. <dd><p>Client specified an invalid argument.</p>
  633. </dd></dl>
  634. <dl class="py attribute">
  635. <dt id="grpc.StatusCode.DEADLINE_EXCEEDED">
  636. <code class="sig-name descname">DEADLINE_EXCEEDED</code><a class="headerlink" href="#grpc.StatusCode.DEADLINE_EXCEEDED" title="Permalink to this definition">¶</a></dt>
  637. <dd><p>Deadline expired before operation could complete.</p>
  638. </dd></dl>
  639. <dl class="py attribute">
  640. <dt id="grpc.StatusCode.NOT_FOUND">
  641. <code class="sig-name descname">NOT_FOUND</code><a class="headerlink" href="#grpc.StatusCode.NOT_FOUND" title="Permalink to this definition">¶</a></dt>
  642. <dd><p>Some requested entity (e.g., file or directory) was not found.</p>
  643. </dd></dl>
  644. <dl class="py attribute">
  645. <dt id="grpc.StatusCode.ALREADY_EXISTS">
  646. <code class="sig-name descname">ALREADY_EXISTS</code><a class="headerlink" href="#grpc.StatusCode.ALREADY_EXISTS" title="Permalink to this definition">¶</a></dt>
  647. <dd><p>Some entity that we attempted to create (e.g., file or directory)
  648. already exists.</p>
  649. </dd></dl>
  650. <dl class="py attribute">
  651. <dt id="grpc.StatusCode.PERMISSION_DENIED">
  652. <code class="sig-name descname">PERMISSION_DENIED</code><a class="headerlink" href="#grpc.StatusCode.PERMISSION_DENIED" title="Permalink to this definition">¶</a></dt>
  653. <dd><p>The caller does not have permission to execute the specified
  654. operation.</p>
  655. </dd></dl>
  656. <dl class="py attribute">
  657. <dt id="grpc.StatusCode.UNAUTHENTICATED">
  658. <code class="sig-name descname">UNAUTHENTICATED</code><a class="headerlink" href="#grpc.StatusCode.UNAUTHENTICATED" title="Permalink to this definition">¶</a></dt>
  659. <dd><p>The request does not have valid authentication credentials for the
  660. operation.</p>
  661. </dd></dl>
  662. <dl class="py attribute">
  663. <dt id="grpc.StatusCode.RESOURCE_EXHAUSTED">
  664. <code class="sig-name descname">RESOURCE_EXHAUSTED</code><a class="headerlink" href="#grpc.StatusCode.RESOURCE_EXHAUSTED" title="Permalink to this definition">¶</a></dt>
  665. <dd><p>Some resource has been exhausted, perhaps a per-user quota, or
  666. perhaps the entire file system is out of space.</p>
  667. </dd></dl>
  668. <dl class="py attribute">
  669. <dt id="grpc.StatusCode.FAILED_PRECONDITION">
  670. <code class="sig-name descname">FAILED_PRECONDITION</code><a class="headerlink" href="#grpc.StatusCode.FAILED_PRECONDITION" title="Permalink to this definition">¶</a></dt>
  671. <dd><p>Operation was rejected because the system is not in a state
  672. required for the operation’s execution.</p>
  673. </dd></dl>
  674. <dl class="py attribute">
  675. <dt id="grpc.StatusCode.ABORTED">
  676. <code class="sig-name descname">ABORTED</code><a class="headerlink" href="#grpc.StatusCode.ABORTED" title="Permalink to this definition">¶</a></dt>
  677. <dd><p>The operation was aborted, typically due to a concurrency issue
  678. like sequencer check failures, transaction aborts, etc.</p>
  679. </dd></dl>
  680. <dl class="py attribute">
  681. <dt id="grpc.StatusCode.UNIMPLEMENTED">
  682. <code class="sig-name descname">UNIMPLEMENTED</code><a class="headerlink" href="#grpc.StatusCode.UNIMPLEMENTED" title="Permalink to this definition">¶</a></dt>
  683. <dd><p>Operation is not implemented or not supported/enabled in this service.</p>
  684. </dd></dl>
  685. <dl class="py attribute">
  686. <dt id="grpc.StatusCode.INTERNAL">
  687. <code class="sig-name descname">INTERNAL</code><a class="headerlink" href="#grpc.StatusCode.INTERNAL" title="Permalink to this definition">¶</a></dt>
  688. <dd><p>Internal errors. Means some invariants expected by underlying
  689. system has been broken.</p>
  690. </dd></dl>
  691. <dl class="py attribute">
  692. <dt id="grpc.StatusCode.UNAVAILABLE">
  693. <code class="sig-name descname">UNAVAILABLE</code><a class="headerlink" href="#grpc.StatusCode.UNAVAILABLE" title="Permalink to this definition">¶</a></dt>
  694. <dd><p>The service is currently unavailable.</p>
  695. </dd></dl>
  696. <dl class="py attribute">
  697. <dt id="grpc.StatusCode.DATA_LOSS">
  698. <code class="sig-name descname">DATA_LOSS</code><a class="headerlink" href="#grpc.StatusCode.DATA_LOSS" title="Permalink to this definition">¶</a></dt>
  699. <dd><p>Unrecoverable data loss or corruption.</p>
  700. </dd></dl>
  701. </dd></dl>
  702. </div>
  703. <div class="section" id="channel-object">
  704. <h3>Channel Object<a class="headerlink" href="#channel-object" title="Permalink to this headline">¶</a></h3>
  705. <dl class="py class">
  706. <dt id="grpc.Channel">
  707. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Channel</code><a class="reference internal" href="_modules/grpc.html#Channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel" title="Permalink to this definition">¶</a></dt>
  708. <dd><p>Affords RPC invocation via generic methods on client-side.</p>
  709. <p>Channel objects implement the Context Manager type, although they need not
  710. support being entered and exited multiple times.</p>
  711. <dl class="py method">
  712. <dt id="grpc.Channel.__enter__">
  713. <code class="sig-name descname">__enter__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.__enter__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.__enter__" title="Permalink to this definition">¶</a></dt>
  714. <dd><p>Enters the runtime context related to the channel object.</p>
  715. </dd></dl>
  716. <dl class="py method">
  717. <dt id="grpc.Channel.__exit__">
  718. <code class="sig-name descname">__exit__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">exc_type</span></em>, <em class="sig-param"><span class="n">exc_val</span></em>, <em class="sig-param"><span class="n">exc_tb</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.__exit__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.__exit__" title="Permalink to this definition">¶</a></dt>
  719. <dd><p>Exits the runtime context related to the channel object.</p>
  720. </dd></dl>
  721. <dl class="py method">
  722. <dt id="grpc.Channel.close">
  723. <em class="property">abstract </em><code class="sig-name descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.close"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.close" title="Permalink to this definition">¶</a></dt>
  724. <dd><p>Closes this Channel and releases all resources held by it.</p>
  725. <p>Closing the Channel will immediately terminate all RPCs active with the
  726. Channel and it is not valid to invoke new RPCs with the Channel.</p>
  727. <p>This method is idempotent.</p>
  728. </dd></dl>
  729. <dl class="py method">
  730. <dt id="grpc.Channel.stream_stream">
  731. <em class="property">abstract </em><code class="sig-name descname">stream_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.stream_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.stream_stream" title="Permalink to this definition">¶</a></dt>
  732. <dd><p>Creates a StreamStreamMultiCallable for a stream-stream method.</p>
  733. <dl class="field-list simple">
  734. <dt class="field-odd">Parameters</dt>
  735. <dd class="field-odd"><ul class="simple">
  736. <li><p><strong>method</strong> – The name of the RPC method.</p></li>
  737. <li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  738. message. Request goes unserialized in case None is passed.</p></li>
  739. <li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  740. response message. Response goes undeserialized in case None
  741. is passed.</p></li>
  742. </ul>
  743. </dd>
  744. <dt class="field-even">Returns</dt>
  745. <dd class="field-even"><p>A StreamStreamMultiCallable value for the named stream-stream method.</p>
  746. </dd>
  747. </dl>
  748. </dd></dl>
  749. <dl class="py method">
  750. <dt id="grpc.Channel.stream_unary">
  751. <em class="property">abstract </em><code class="sig-name descname">stream_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.stream_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.stream_unary" title="Permalink to this definition">¶</a></dt>
  752. <dd><p>Creates a StreamUnaryMultiCallable for a stream-unary method.</p>
  753. <dl class="field-list simple">
  754. <dt class="field-odd">Parameters</dt>
  755. <dd class="field-odd"><ul class="simple">
  756. <li><p><strong>method</strong> – The name of the RPC method.</p></li>
  757. <li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  758. message. Request goes unserialized in case None is passed.</p></li>
  759. <li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  760. response message. Response goes undeserialized in case None is
  761. passed.</p></li>
  762. </ul>
  763. </dd>
  764. <dt class="field-even">Returns</dt>
  765. <dd class="field-even"><p>A StreamUnaryMultiCallable value for the named stream-unary method.</p>
  766. </dd>
  767. </dl>
  768. </dd></dl>
  769. <dl class="py method">
  770. <dt id="grpc.Channel.subscribe">
  771. <em class="property">abstract </em><code class="sig-name descname">subscribe</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em>, <em class="sig-param"><span class="n">try_to_connect</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.subscribe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.subscribe" title="Permalink to this definition">¶</a></dt>
  772. <dd><p>Subscribe to this Channel’s connectivity state machine.</p>
  773. <p>A Channel may be in any of the states described by ChannelConnectivity.
  774. This method allows application to monitor the state transitions.
  775. The typical use case is to debug or gain better visibility into gRPC
  776. runtime’s state.</p>
  777. <dl class="field-list simple">
  778. <dt class="field-odd">Parameters</dt>
  779. <dd class="field-odd"><ul class="simple">
  780. <li><p><strong>callback</strong> – A callable to be invoked with ChannelConnectivity argument.
  781. ChannelConnectivity describes current state of the channel.
  782. The callable will be invoked immediately upon subscription
  783. and again for every change to ChannelConnectivity until it
  784. is unsubscribed or this Channel object goes out of scope.</p></li>
  785. <li><p><strong>try_to_connect</strong> – A boolean indicating whether or not this Channel
  786. should attempt to connect immediately. If set to False, gRPC
  787. runtime decides when to connect.</p></li>
  788. </ul>
  789. </dd>
  790. </dl>
  791. </dd></dl>
  792. <dl class="py method">
  793. <dt id="grpc.Channel.unary_stream">
  794. <em class="property">abstract </em><code class="sig-name descname">unary_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.unary_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.unary_stream" title="Permalink to this definition">¶</a></dt>
  795. <dd><p>Creates a UnaryStreamMultiCallable for a unary-stream method.</p>
  796. <dl class="field-list simple">
  797. <dt class="field-odd">Parameters</dt>
  798. <dd class="field-odd"><ul class="simple">
  799. <li><p><strong>method</strong> – The name of the RPC method.</p></li>
  800. <li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  801. message. Request goes unserialized in case None is passed.</p></li>
  802. <li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  803. response message. Response goes undeserialized in case None is
  804. passed.</p></li>
  805. </ul>
  806. </dd>
  807. <dt class="field-even">Returns</dt>
  808. <dd class="field-even"><p>A UnaryStreamMultiCallable value for the name unary-stream method.</p>
  809. </dd>
  810. </dl>
  811. </dd></dl>
  812. <dl class="py method">
  813. <dt id="grpc.Channel.unary_unary">
  814. <em class="property">abstract </em><code class="sig-name descname">unary_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">method</span></em>, <em class="sig-param"><span class="n">request_serializer</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response_deserializer</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.unary_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.unary_unary" title="Permalink to this definition">¶</a></dt>
  815. <dd><p>Creates a UnaryUnaryMultiCallable for a unary-unary method.</p>
  816. <dl class="field-list simple">
  817. <dt class="field-odd">Parameters</dt>
  818. <dd class="field-odd"><ul class="simple">
  819. <li><p><strong>method</strong> – The name of the RPC method.</p></li>
  820. <li><p><strong>request_serializer</strong> – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  821. message. Request goes unserialized in case None is passed.</p></li>
  822. <li><p><strong>response_deserializer</strong> – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  823. response message. Response goes undeserialized in case None
  824. is passed.</p></li>
  825. </ul>
  826. </dd>
  827. <dt class="field-even">Returns</dt>
  828. <dd class="field-even"><p>A UnaryUnaryMultiCallable value for the named unary-unary method.</p>
  829. </dd>
  830. </dl>
  831. </dd></dl>
  832. <dl class="py method">
  833. <dt id="grpc.Channel.unsubscribe">
  834. <em class="property">abstract </em><code class="sig-name descname">unsubscribe</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Channel.unsubscribe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Channel.unsubscribe" title="Permalink to this definition">¶</a></dt>
  835. <dd><p>Unsubscribes a subscribed callback from this Channel’s connectivity.</p>
  836. <dl class="field-list simple">
  837. <dt class="field-odd">Parameters</dt>
  838. <dd class="field-odd"><ul class="simple">
  839. <li><p><strong>callback</strong> – A callable previously registered with this Channel from</p></li>
  840. <li><p><strong>been passed to its &quot;subscribe&quot; method.</strong> (<em>having</em>) – </p></li>
  841. </ul>
  842. </dd>
  843. </dl>
  844. </dd></dl>
  845. </dd></dl>
  846. </div>
  847. <div class="section" id="server-object">
  848. <h3>Server Object<a class="headerlink" href="#server-object" title="Permalink to this headline">¶</a></h3>
  849. <dl class="py class">
  850. <dt id="grpc.Server">
  851. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Server</code><a class="reference internal" href="_modules/grpc.html#Server"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server" title="Permalink to this definition">¶</a></dt>
  852. <dd><p>Services RPCs.</p>
  853. <dl class="py method">
  854. <dt id="grpc.Server.add_generic_rpc_handlers">
  855. <em class="property">abstract </em><code class="sig-name descname">add_generic_rpc_handlers</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">generic_rpc_handlers</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.add_generic_rpc_handlers"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.add_generic_rpc_handlers" title="Permalink to this definition">¶</a></dt>
  856. <dd><p>Registers GenericRpcHandlers with this Server.</p>
  857. <p>This method is only safe to call before the server is started.</p>
  858. <dl class="field-list simple">
  859. <dt class="field-odd">Parameters</dt>
  860. <dd class="field-odd"><ul class="simple">
  861. <li><p><strong>generic_rpc_handlers</strong> – An iterable of GenericRpcHandlers that will be</p></li>
  862. <li><p><strong>to service RPCs.</strong> (<em>used</em>) – </p></li>
  863. </ul>
  864. </dd>
  865. </dl>
  866. </dd></dl>
  867. <dl class="py method">
  868. <dt id="grpc.Server.add_insecure_port">
  869. <em class="property">abstract </em><code class="sig-name descname">add_insecure_port</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">address</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.add_insecure_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.add_insecure_port" title="Permalink to this definition">¶</a></dt>
  870. <dd><p>Opens an insecure port for accepting RPCs.</p>
  871. <p>This method may only be called before starting the server.</p>
  872. <dl class="field-list simple">
  873. <dt class="field-odd">Parameters</dt>
  874. <dd class="field-odd"><p><strong>address</strong> – The address for which to open a port. If the port is 0,
  875. or not specified in the address, then gRPC runtime will choose a port.</p>
  876. </dd>
  877. <dt class="field-even">Returns</dt>
  878. <dd class="field-even"><p>An integer port on which server will accept RPC requests.</p>
  879. </dd>
  880. </dl>
  881. </dd></dl>
  882. <dl class="py method">
  883. <dt id="grpc.Server.add_secure_port">
  884. <em class="property">abstract </em><code class="sig-name descname">add_secure_port</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">address</span></em>, <em class="sig-param"><span class="n">server_credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.add_secure_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.add_secure_port" title="Permalink to this definition">¶</a></dt>
  885. <dd><p>Opens a secure port for accepting RPCs.</p>
  886. <p>This method may only be called before starting the server.</p>
  887. <dl class="field-list simple">
  888. <dt class="field-odd">Parameters</dt>
  889. <dd class="field-odd"><ul class="simple">
  890. <li><p><strong>address</strong> – The address for which to open a port.
  891. if the port is 0, or not specified in the address, then gRPC
  892. runtime will choose a port.</p></li>
  893. <li><p><strong>server_credentials</strong> – A ServerCredentials object.</p></li>
  894. </ul>
  895. </dd>
  896. <dt class="field-even">Returns</dt>
  897. <dd class="field-even"><p>An integer port on which server will accept RPC requests.</p>
  898. </dd>
  899. </dl>
  900. </dd></dl>
  901. <dl class="py method">
  902. <dt id="grpc.Server.start">
  903. <em class="property">abstract </em><code class="sig-name descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.start" title="Permalink to this definition">¶</a></dt>
  904. <dd><p>Starts this Server.</p>
  905. <p>This method may only be called once. (i.e. it is not idempotent).</p>
  906. </dd></dl>
  907. <dl class="py method">
  908. <dt id="grpc.Server.stop">
  909. <em class="property">abstract </em><code class="sig-name descname">stop</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">grace</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.stop"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.stop" title="Permalink to this definition">¶</a></dt>
  910. <dd><p>Stops this Server.</p>
  911. <p>This method immediately stop service of new RPCs in all cases.</p>
  912. <p>If a grace period is specified, this method returns immediately
  913. and all RPCs active at the end of the grace period are aborted.
  914. If a grace period is not specified (by passing None for <cite>grace</cite>),
  915. all existing RPCs are aborted immediately and this method
  916. blocks until the last RPC handler terminates.</p>
  917. <p>This method is idempotent and may be called at any time.
  918. Passing a smaller grace value in a subsequent call will have
  919. the effect of stopping the Server sooner (passing None will
  920. have the effect of stopping the server immediately). Passing
  921. a larger grace value in a subsequent call <em>will not</em> have the
  922. effect of stopping the server later (i.e. the most restrictive
  923. grace value is used).</p>
  924. <dl class="field-list simple">
  925. <dt class="field-odd">Parameters</dt>
  926. <dd class="field-odd"><p><strong>grace</strong> – A duration of time in seconds or None.</p>
  927. </dd>
  928. <dt class="field-even">Returns</dt>
  929. <dd class="field-even"><p>A threading.Event that will be set when this Server has completely
  930. stopped, i.e. when running RPCs either complete or are aborted and
  931. all handlers have terminated.</p>
  932. </dd>
  933. </dl>
  934. </dd></dl>
  935. <dl class="py method">
  936. <dt id="grpc.Server.wait_for_termination">
  937. <code class="sig-name descname">wait_for_termination</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Server.wait_for_termination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Server.wait_for_termination" title="Permalink to this definition">¶</a></dt>
  938. <dd><p>Block current thread until the server stops.</p>
  939. <p>This is an EXPERIMENTAL API.</p>
  940. <p>The wait will not consume computational resources during blocking, and
  941. it will block until one of the two following conditions are met:</p>
  942. <ol class="arabic simple">
  943. <li><p>The server is stopped or terminated;</p></li>
  944. <li><p>A timeout occurs if timeout is not <cite>None</cite>.</p></li>
  945. </ol>
  946. <p>The timeout argument works in the same way as <cite>threading.Event.wait()</cite>.
  947. <a class="reference external" href="https://docs.python.org/3/library/threading.html#threading.Event.wait">https://docs.python.org/3/library/threading.html#threading.Event.wait</a></p>
  948. <dl class="field-list simple">
  949. <dt class="field-odd">Parameters</dt>
  950. <dd class="field-odd"><p><strong>timeout</strong> – A floating point number specifying a timeout for the
  951. operation in seconds.</p>
  952. </dd>
  953. <dt class="field-even">Returns</dt>
  954. <dd class="field-even"><p>A bool indicates if the operation times out.</p>
  955. </dd>
  956. </dl>
  957. </dd></dl>
  958. </dd></dl>
  959. </div>
  960. <div class="section" id="authentication-authorization-objects">
  961. <h3>Authentication &amp; Authorization Objects<a class="headerlink" href="#authentication-authorization-objects" title="Permalink to this headline">¶</a></h3>
  962. <dl class="py class">
  963. <dt id="grpc.ChannelCredentials">
  964. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ChannelCredentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ChannelCredentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ChannelCredentials" title="Permalink to this definition">¶</a></dt>
  965. <dd><p>An encapsulation of the data required to create a secure Channel.</p>
  966. <p>This class has no supported interface - it exists to define the type of its
  967. instances and its instances exist to be passed to other functions. For
  968. example, ssl_channel_credentials returns an instance of this class and
  969. secure_channel requires an instance of this class.</p>
  970. </dd></dl>
  971. <dl class="py class">
  972. <dt id="grpc.CallCredentials">
  973. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">CallCredentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#CallCredentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.CallCredentials" title="Permalink to this definition">¶</a></dt>
  974. <dd><p>An encapsulation of the data required to assert an identity over a call.</p>
  975. <p>A CallCredentials has to be used with secure Channel, otherwise the
  976. metadata will not be transmitted to the server.</p>
  977. <p>A CallCredentials may be composed with ChannelCredentials to always assert
  978. identity for every call over that Channel.</p>
  979. <p>This class has no supported interface - it exists to define the type of its
  980. instances and its instances exist to be passed to other functions.</p>
  981. </dd></dl>
  982. <dl class="py class">
  983. <dt id="grpc.AuthMetadataContext">
  984. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">AuthMetadataContext</code><a class="reference internal" href="_modules/grpc.html#AuthMetadataContext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataContext" title="Permalink to this definition">¶</a></dt>
  985. <dd><p>Provides information to call credentials metadata plugins.</p>
  986. <dl class="py attribute">
  987. <dt id="grpc.AuthMetadataContext.service_url">
  988. <code class="sig-name descname">service_url</code><a class="headerlink" href="#grpc.AuthMetadataContext.service_url" title="Permalink to this definition">¶</a></dt>
  989. <dd><p>A string URL of the service being called into.</p>
  990. </dd></dl>
  991. <dl class="py attribute">
  992. <dt id="grpc.AuthMetadataContext.method_name">
  993. <code class="sig-name descname">method_name</code><a class="headerlink" href="#grpc.AuthMetadataContext.method_name" title="Permalink to this definition">¶</a></dt>
  994. <dd><p>A string of the fully qualified method name being called.</p>
  995. </dd></dl>
  996. </dd></dl>
  997. <dl class="py class">
  998. <dt id="grpc.AuthMetadataPluginCallback">
  999. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">AuthMetadataPluginCallback</code><a class="reference internal" href="_modules/grpc.html#AuthMetadataPluginCallback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPluginCallback" title="Permalink to this definition">¶</a></dt>
  1000. <dd><p>Callback object received by a metadata plugin.</p>
  1001. <dl class="py method">
  1002. <dt id="grpc.AuthMetadataPluginCallback.__call__">
  1003. <code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">metadata</span></em>, <em class="sig-param"><span class="n">error</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#AuthMetadataPluginCallback.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPluginCallback.__call__" title="Permalink to this definition">¶</a></dt>
  1004. <dd><p>Passes to the gRPC runtime authentication metadata for an RPC.</p>
  1005. <dl class="field-list simple">
  1006. <dt class="field-odd">Parameters</dt>
  1007. <dd class="field-odd"><ul class="simple">
  1008. <li><p><strong>metadata</strong> – The <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> used to construct the CallCredentials.</p></li>
  1009. <li><p><strong>error</strong> – An Exception to indicate error or None to indicate success.</p></li>
  1010. </ul>
  1011. </dd>
  1012. </dl>
  1013. </dd></dl>
  1014. </dd></dl>
  1015. <dl class="py class">
  1016. <dt id="grpc.AuthMetadataPlugin">
  1017. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">AuthMetadataPlugin</code><a class="reference internal" href="_modules/grpc.html#AuthMetadataPlugin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPlugin" title="Permalink to this definition">¶</a></dt>
  1018. <dd><p>A specification for custom authentication.</p>
  1019. <dl class="py method">
  1020. <dt id="grpc.AuthMetadataPlugin.__call__">
  1021. <code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">context</span></em>, <em class="sig-param"><span class="n">callback</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#AuthMetadataPlugin.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.AuthMetadataPlugin.__call__" title="Permalink to this definition">¶</a></dt>
  1022. <dd><p>Implements authentication by passing metadata to a callback.</p>
  1023. <p>This method will be invoked asynchronously in a separate thread.</p>
  1024. <dl class="field-list simple">
  1025. <dt class="field-odd">Parameters</dt>
  1026. <dd class="field-odd"><ul class="simple">
  1027. <li><p><strong>context</strong> – An AuthMetadataContext providing information on the RPC that
  1028. the plugin is being called to authenticate.</p></li>
  1029. <li><p><strong>callback</strong> – An AuthMetadataPluginCallback to be invoked either
  1030. synchronously or asynchronously.</p></li>
  1031. </ul>
  1032. </dd>
  1033. </dl>
  1034. </dd></dl>
  1035. </dd></dl>
  1036. <dl class="py class">
  1037. <dt id="grpc.ServerCredentials">
  1038. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServerCredentials</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">credentials</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServerCredentials"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerCredentials" title="Permalink to this definition">¶</a></dt>
  1039. <dd><p>An encapsulation of the data required to open a secure port on a Server.</p>
  1040. <p>This class has no supported interface - it exists to define the type of its
  1041. instances and its instances exist to be passed to other functions.</p>
  1042. </dd></dl>
  1043. <dl class="py class">
  1044. <dt id="grpc.ServerCertificateConfiguration">
  1045. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServerCertificateConfiguration</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">certificate_configuration</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServerCertificateConfiguration"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerCertificateConfiguration" title="Permalink to this definition">¶</a></dt>
  1046. <dd><p>A certificate configuration for use with an SSL-enabled Server.</p>
  1047. <p>Instances of this class can be returned in the certificate configuration
  1048. fetching callback.</p>
  1049. <p>This class has no supported interface – it exists to define the
  1050. type of its instances and its instances exist to be passed to
  1051. other functions.</p>
  1052. </dd></dl>
  1053. </div>
  1054. <div class="section" id="grpc-exceptions">
  1055. <h3>gRPC Exceptions<a class="headerlink" href="#grpc-exceptions" title="Permalink to this headline">¶</a></h3>
  1056. <dl class="py exception">
  1057. <dt id="grpc.RpcError">
  1058. <em class="property">exception </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">RpcError</code><a class="reference internal" href="_modules/grpc.html#RpcError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcError" title="Permalink to this definition">¶</a></dt>
  1059. <dd><p>Raised by the gRPC library to indicate non-OK-status RPC termination.</p>
  1060. </dd></dl>
  1061. </div>
  1062. <div class="section" id="shared-context">
  1063. <h3>Shared Context<a class="headerlink" href="#shared-context" title="Permalink to this headline">¶</a></h3>
  1064. <dl class="py class">
  1065. <dt id="grpc.RpcContext">
  1066. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">RpcContext</code><a class="reference internal" href="_modules/grpc.html#RpcContext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext" title="Permalink to this definition">¶</a></dt>
  1067. <dd><p>Provides RPC-related information and action.</p>
  1068. <dl class="py method">
  1069. <dt id="grpc.RpcContext.add_callback">
  1070. <em class="property">abstract </em><code class="sig-name descname">add_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.add_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.add_callback" title="Permalink to this definition">¶</a></dt>
  1071. <dd><p>Registers a callback to be called on RPC termination.</p>
  1072. <dl class="field-list simple">
  1073. <dt class="field-odd">Parameters</dt>
  1074. <dd class="field-odd"><p><strong>callback</strong> – A no-parameter callable to be called on RPC termination.</p>
  1075. </dd>
  1076. <dt class="field-even">Returns</dt>
  1077. <dd class="field-even"><p><dl class="simple">
  1078. <dt>True if the callback was added and will be called later; False if</dt><dd><p>the callback was not added and will not be called (because the RPC
  1079. already terminated or some other reason).</p>
  1080. </dd>
  1081. </dl>
  1082. </p>
  1083. </dd>
  1084. </dl>
  1085. </dd></dl>
  1086. <dl class="py method">
  1087. <dt id="grpc.RpcContext.cancel">
  1088. <em class="property">abstract </em><code class="sig-name descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.cancel" title="Permalink to this definition">¶</a></dt>
  1089. <dd><p>Cancels the RPC.</p>
  1090. <p>Idempotent and has no effect if the RPC has already terminated.</p>
  1091. </dd></dl>
  1092. <dl class="py method">
  1093. <dt id="grpc.RpcContext.is_active">
  1094. <em class="property">abstract </em><code class="sig-name descname">is_active</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.is_active"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.is_active" title="Permalink to this definition">¶</a></dt>
  1095. <dd><p>Describes whether the RPC is active or has terminated.</p>
  1096. <dl class="field-list simple">
  1097. <dt class="field-odd">Returns</dt>
  1098. <dd class="field-odd"><p>True if RPC is active, False otherwise.</p>
  1099. </dd>
  1100. <dt class="field-even">Return type</dt>
  1101. <dd class="field-even"><p>bool</p>
  1102. </dd>
  1103. </dl>
  1104. </dd></dl>
  1105. <dl class="py method">
  1106. <dt id="grpc.RpcContext.time_remaining">
  1107. <em class="property">abstract </em><code class="sig-name descname">time_remaining</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#RpcContext.time_remaining"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcContext.time_remaining" title="Permalink to this definition">¶</a></dt>
  1108. <dd><p>Describes the length of allowed time remaining for the RPC.</p>
  1109. <dl class="field-list simple">
  1110. <dt class="field-odd">Returns</dt>
  1111. <dd class="field-odd"><p>A nonnegative float indicating the length of allowed time in seconds
  1112. remaining for the RPC to complete before it is considered to have
  1113. timed out, or None if no deadline was specified for the RPC.</p>
  1114. </dd>
  1115. </dl>
  1116. </dd></dl>
  1117. </dd></dl>
  1118. </div>
  1119. <div class="section" id="client-side-context">
  1120. <h3>Client-Side Context<a class="headerlink" href="#client-side-context" title="Permalink to this headline">¶</a></h3>
  1121. <dl class="py class">
  1122. <dt id="grpc.Call">
  1123. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Call</code><a class="reference internal" href="_modules/grpc.html#Call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call" title="Permalink to this definition">¶</a></dt>
  1124. <dd><p>Invocation-side utility object for an RPC.</p>
  1125. <dl class="py method">
  1126. <dt id="grpc.Call.code">
  1127. <em class="property">abstract </em><code class="sig-name descname">code</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.code" title="Permalink to this definition">¶</a></dt>
  1128. <dd><p>Accesses the status code sent by the server.</p>
  1129. <p>This method blocks until the value is available.</p>
  1130. <dl class="field-list simple">
  1131. <dt class="field-odd">Returns</dt>
  1132. <dd class="field-odd"><p>The StatusCode value for the RPC.</p>
  1133. </dd>
  1134. </dl>
  1135. </dd></dl>
  1136. <dl class="py method">
  1137. <dt id="grpc.Call.details">
  1138. <em class="property">abstract </em><code class="sig-name descname">details</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.details"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.details" title="Permalink to this definition">¶</a></dt>
  1139. <dd><p>Accesses the details sent by the server.</p>
  1140. <p>This method blocks until the value is available.</p>
  1141. <dl class="field-list simple">
  1142. <dt class="field-odd">Returns</dt>
  1143. <dd class="field-odd"><p>The details string of the RPC.</p>
  1144. </dd>
  1145. </dl>
  1146. </dd></dl>
  1147. <dl class="py method">
  1148. <dt id="grpc.Call.initial_metadata">
  1149. <em class="property">abstract </em><code class="sig-name descname">initial_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.initial_metadata" title="Permalink to this definition">¶</a></dt>
  1150. <dd><p>Accesses the initial metadata sent by the server.</p>
  1151. <p>This method blocks until the value is available.</p>
  1152. <dl class="field-list simple">
  1153. <dt class="field-odd">Returns</dt>
  1154. <dd class="field-odd"><p>The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1155. </dd>
  1156. </dl>
  1157. </dd></dl>
  1158. <dl class="py method">
  1159. <dt id="grpc.Call.trailing_metadata">
  1160. <em class="property">abstract </em><code class="sig-name descname">trailing_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Call.trailing_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Call.trailing_metadata" title="Permalink to this definition">¶</a></dt>
  1161. <dd><p>Accesses the trailing metadata sent by the server.</p>
  1162. <p>This method blocks until the value is available.</p>
  1163. <dl class="field-list simple">
  1164. <dt class="field-odd">Returns</dt>
  1165. <dd class="field-odd"><p>The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1166. </dd>
  1167. </dl>
  1168. </dd></dl>
  1169. </dd></dl>
  1170. </div>
  1171. <div class="section" id="client-side-interceptor">
  1172. <h3>Client-Side Interceptor<a class="headerlink" href="#client-side-interceptor" title="Permalink to this headline">¶</a></h3>
  1173. <dl class="py class">
  1174. <dt id="grpc.ClientCallDetails">
  1175. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ClientCallDetails</code><a class="reference internal" href="_modules/grpc.html#ClientCallDetails"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ClientCallDetails" title="Permalink to this definition">¶</a></dt>
  1176. <dd><p>Describes an RPC to be invoked.</p>
  1177. <p>This is an EXPERIMENTAL API.</p>
  1178. <dl class="py attribute">
  1179. <dt id="grpc.ClientCallDetails.method">
  1180. <code class="sig-name descname">method</code><a class="headerlink" href="#grpc.ClientCallDetails.method" title="Permalink to this definition">¶</a></dt>
  1181. <dd><p>The method name of the RPC.</p>
  1182. </dd></dl>
  1183. <dl class="py attribute">
  1184. <dt id="grpc.ClientCallDetails.timeout">
  1185. <code class="sig-name descname">timeout</code><a class="headerlink" href="#grpc.ClientCallDetails.timeout" title="Permalink to this definition">¶</a></dt>
  1186. <dd><p>An optional duration of time in seconds to allow for the RPC.</p>
  1187. </dd></dl>
  1188. <dl class="py attribute">
  1189. <dt id="grpc.ClientCallDetails.metadata">
  1190. <code class="sig-name descname">metadata</code><a class="headerlink" href="#grpc.ClientCallDetails.metadata" title="Permalink to this definition">¶</a></dt>
  1191. <dd><p>Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to
  1192. the service-side of the RPC.</p>
  1193. </dd></dl>
  1194. <dl class="py attribute">
  1195. <dt id="grpc.ClientCallDetails.credentials">
  1196. <code class="sig-name descname">credentials</code><a class="headerlink" href="#grpc.ClientCallDetails.credentials" title="Permalink to this definition">¶</a></dt>
  1197. <dd><p>An optional CallCredentials for the RPC.</p>
  1198. </dd></dl>
  1199. <dl class="py attribute">
  1200. <dt id="grpc.ClientCallDetails.wait_for_ready">
  1201. <code class="sig-name descname">wait_for_ready</code><a class="headerlink" href="#grpc.ClientCallDetails.wait_for_ready" title="Permalink to this definition">¶</a></dt>
  1202. <dd><p>This is an EXPERIMENTAL argument. An optional
  1203. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p>
  1204. </dd></dl>
  1205. <dl class="py attribute">
  1206. <dt id="grpc.ClientCallDetails.compression">
  1207. <code class="sig-name descname">compression</code><a class="headerlink" href="#grpc.ClientCallDetails.compression" title="Permalink to this definition">¶</a></dt>
  1208. <dd><p>An element of grpc.compression, e.g.
  1209. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p>
  1210. </dd></dl>
  1211. </dd></dl>
  1212. <dl class="py class">
  1213. <dt id="grpc.UnaryUnaryClientInterceptor">
  1214. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryUnaryClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#UnaryUnaryClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1215. <dd><p>Affords intercepting unary-unary invocations.</p>
  1216. <p>This is an EXPERIMENTAL API.</p>
  1217. <dl class="py method">
  1218. <dt id="grpc.UnaryUnaryClientInterceptor.intercept_unary_unary">
  1219. <em class="property">abstract </em><code class="sig-name descname">intercept_unary_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryClientInterceptor.intercept_unary_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryClientInterceptor.intercept_unary_unary" title="Permalink to this definition">¶</a></dt>
  1220. <dd><p>Intercepts a unary-unary invocation asynchronously.</p>
  1221. <dl class="field-list simple">
  1222. <dt class="field-odd">Parameters</dt>
  1223. <dd class="field-odd"><ul class="simple">
  1224. <li><p><strong>continuation</strong> – A function that proceeds with the invocation by
  1225. executing the next interceptor in chain or invoking the
  1226. actual RPC on the underlying Channel. It is the interceptor’s
  1227. responsibility to call it if it decides to move the RPC forward.
  1228. The interceptor can use
  1229. <cite>response_future = continuation(client_call_details, request)</cite>
  1230. to continue with the RPC. <cite>continuation</cite> returns an object that is
  1231. both a Call for the RPC and a Future. In the event of RPC
  1232. completion, the return Call-Future’s result value will be
  1233. the response message of the RPC. Should the event terminate
  1234. with non-OK status, the returned Call-Future’s exception value
  1235. will be an RpcError.</p></li>
  1236. <li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
  1237. outgoing RPC.</p></li>
  1238. <li><p><strong>request</strong> – The request value for the RPC.</p></li>
  1239. </ul>
  1240. </dd>
  1241. <dt class="field-even">Returns</dt>
  1242. <dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
  1243. In the event of RPC completion, the return Call-Future’s
  1244. result value will be the response message of the RPC.
  1245. Should the event terminate with non-OK status, the returned
  1246. Call-Future’s exception value will be an RpcError.</p>
  1247. </dd>
  1248. </dl>
  1249. </dd></dl>
  1250. </dd></dl>
  1251. <dl class="py class">
  1252. <dt id="grpc.UnaryStreamClientInterceptor">
  1253. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryStreamClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#UnaryStreamClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1254. <dd><p>Affords intercepting unary-stream invocations.</p>
  1255. <p>This is an EXPERIMENTAL API.</p>
  1256. <dl class="py method">
  1257. <dt id="grpc.UnaryStreamClientInterceptor.intercept_unary_stream">
  1258. <em class="property">abstract </em><code class="sig-name descname">intercept_unary_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryStreamClientInterceptor.intercept_unary_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamClientInterceptor.intercept_unary_stream" title="Permalink to this definition">¶</a></dt>
  1259. <dd><p>Intercepts a unary-stream invocation.</p>
  1260. <dl class="field-list simple">
  1261. <dt class="field-odd">Parameters</dt>
  1262. <dd class="field-odd"><ul class="simple">
  1263. <li><p><strong>continuation</strong> – A function that proceeds with the invocation by
  1264. executing the next interceptor in chain or invoking the
  1265. actual RPC on the underlying Channel. It is the interceptor’s
  1266. responsibility to call it if it decides to move the RPC forward.
  1267. The interceptor can use
  1268. <cite>response_iterator = continuation(client_call_details, request)</cite>
  1269. to continue with the RPC. <cite>continuation</cite> returns an object that is
  1270. both a Call for the RPC and an iterator for response values.
  1271. Drawing response values from the returned Call-iterator may
  1272. raise RpcError indicating termination of the RPC with non-OK
  1273. status.</p></li>
  1274. <li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
  1275. outgoing RPC.</p></li>
  1276. <li><p><strong>request</strong> – The request value for the RPC.</p></li>
  1277. </ul>
  1278. </dd>
  1279. <dt class="field-even">Returns</dt>
  1280. <dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
  1281. response values. Drawing response values from the returned
  1282. Call-iterator may raise RpcError indicating termination of
  1283. the RPC with non-OK status.</p>
  1284. </dd>
  1285. </dl>
  1286. </dd></dl>
  1287. </dd></dl>
  1288. <dl class="py class">
  1289. <dt id="grpc.StreamUnaryClientInterceptor">
  1290. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamUnaryClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#StreamUnaryClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1291. <dd><p>Affords intercepting stream-unary invocations.</p>
  1292. <p>This is an EXPERIMENTAL API.</p>
  1293. <dl class="py method">
  1294. <dt id="grpc.StreamUnaryClientInterceptor.intercept_stream_unary">
  1295. <em class="property">abstract </em><code class="sig-name descname">intercept_stream_unary</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request_iterator</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryClientInterceptor.intercept_stream_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryClientInterceptor.intercept_stream_unary" title="Permalink to this definition">¶</a></dt>
  1296. <dd><p>Intercepts a stream-unary invocation asynchronously.</p>
  1297. <dl class="field-list simple">
  1298. <dt class="field-odd">Parameters</dt>
  1299. <dd class="field-odd"><ul class="simple">
  1300. <li><p><strong>continuation</strong> – A function that proceeds with the invocation by
  1301. executing the next interceptor in chain or invoking the
  1302. actual RPC on the underlying Channel. It is the interceptor’s
  1303. responsibility to call it if it decides to move the RPC forward.
  1304. The interceptor can use
  1305. <cite>response_future = continuation(client_call_details, request_iterator)</cite>
  1306. to continue with the RPC. <cite>continuation</cite> returns an object that is
  1307. both a Call for the RPC and a Future. In the event of RPC completion,
  1308. the return Call-Future’s result value will be the response message
  1309. of the RPC. Should the event terminate with non-OK status, the
  1310. returned Call-Future’s exception value will be an RpcError.</p></li>
  1311. <li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
  1312. outgoing RPC.</p></li>
  1313. <li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
  1314. </ul>
  1315. </dd>
  1316. <dt class="field-even">Returns</dt>
  1317. <dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
  1318. In the event of RPC completion, the return Call-Future’s
  1319. result value will be the response message of the RPC.
  1320. Should the event terminate with non-OK status, the returned
  1321. Call-Future’s exception value will be an RpcError.</p>
  1322. </dd>
  1323. </dl>
  1324. </dd></dl>
  1325. </dd></dl>
  1326. <dl class="py class">
  1327. <dt id="grpc.StreamStreamClientInterceptor">
  1328. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamStreamClientInterceptor</code><a class="reference internal" href="_modules/grpc.html#StreamStreamClientInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1329. <dd><p>Affords intercepting stream-stream invocations.</p>
  1330. <p>This is an EXPERIMENTAL API.</p>
  1331. <dl class="py method">
  1332. <dt id="grpc.StreamStreamClientInterceptor.intercept_stream_stream">
  1333. <em class="property">abstract </em><code class="sig-name descname">intercept_stream_stream</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">client_call_details</span></em>, <em class="sig-param"><span class="n">request_iterator</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamStreamClientInterceptor.intercept_stream_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamClientInterceptor.intercept_stream_stream" title="Permalink to this definition">¶</a></dt>
  1334. <dd><p>Intercepts a stream-stream invocation.</p>
  1335. <dl class="field-list simple">
  1336. <dt class="field-odd">Parameters</dt>
  1337. <dd class="field-odd"><ul class="simple">
  1338. <li><p><strong>continuation</strong> – A function that proceeds with the invocation by
  1339. executing the next interceptor in chain or invoking the
  1340. actual RPC on the underlying Channel. It is the interceptor’s
  1341. responsibility to call it if it decides to move the RPC forward.
  1342. The interceptor can use
  1343. <cite>response_iterator = continuation(client_call_details, request_iterator)</cite>
  1344. to continue with the RPC. <cite>continuation</cite> returns an object that is
  1345. both a Call for the RPC and an iterator for response values.
  1346. Drawing response values from the returned Call-iterator may
  1347. raise RpcError indicating termination of the RPC with non-OK
  1348. status.</p></li>
  1349. <li><p><strong>client_call_details</strong> – A ClientCallDetails object describing the
  1350. outgoing RPC.</p></li>
  1351. <li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
  1352. </ul>
  1353. </dd>
  1354. <dt class="field-even">Returns</dt>
  1355. <dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
  1356. response values. Drawing response values from the returned
  1357. Call-iterator may raise RpcError indicating termination of
  1358. the RPC with non-OK status.</p>
  1359. </dd>
  1360. </dl>
  1361. </dd></dl>
  1362. </dd></dl>
  1363. </div>
  1364. <div class="section" id="service-side-context">
  1365. <h3>Service-Side Context<a class="headerlink" href="#service-side-context" title="Permalink to this headline">¶</a></h3>
  1366. <dl class="py class">
  1367. <dt id="grpc.ServicerContext">
  1368. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServicerContext</code><a class="reference internal" href="_modules/grpc.html#ServicerContext"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext" title="Permalink to this definition">¶</a></dt>
  1369. <dd><p>A context object passed to method implementations.</p>
  1370. <dl class="py method">
  1371. <dt id="grpc.ServicerContext.abort">
  1372. <em class="property">abstract </em><code class="sig-name descname">abort</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">code</span></em>, <em class="sig-param"><span class="n">details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.abort"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.abort" title="Permalink to this definition">¶</a></dt>
  1373. <dd><p>Raises an exception to terminate the RPC with a non-OK status.</p>
  1374. <p>The code and details passed as arguments will supercede any existing
  1375. ones.</p>
  1376. <dl class="field-list simple">
  1377. <dt class="field-odd">Parameters</dt>
  1378. <dd class="field-odd"><ul class="simple">
  1379. <li><p><strong>code</strong> – A StatusCode object to be sent to the client.
  1380. It must not be StatusCode.OK.</p></li>
  1381. <li><p><strong>details</strong> – A UTF-8-encodable string to be sent to the client upon
  1382. termination of the RPC.</p></li>
  1383. </ul>
  1384. </dd>
  1385. <dt class="field-even">Raises</dt>
  1386. <dd class="field-even"><p><strong>Exception</strong> – An exception is always raised to signal the abortion the
  1387. RPC to the gRPC runtime.</p>
  1388. </dd>
  1389. </dl>
  1390. </dd></dl>
  1391. <dl class="py method">
  1392. <dt id="grpc.ServicerContext.abort_with_status">
  1393. <em class="property">abstract </em><code class="sig-name descname">abort_with_status</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">status</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.abort_with_status"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.abort_with_status" title="Permalink to this definition">¶</a></dt>
  1394. <dd><p>Raises an exception to terminate the RPC with a non-OK status.</p>
  1395. <p>The status passed as argument will supercede any existing status code,
  1396. status message and trailing metadata.</p>
  1397. <p>This is an EXPERIMENTAL API.</p>
  1398. <dl class="field-list simple">
  1399. <dt class="field-odd">Parameters</dt>
  1400. <dd class="field-odd"><p><strong>status</strong> – A grpc.Status object. The status code in it must not be
  1401. StatusCode.OK.</p>
  1402. </dd>
  1403. <dt class="field-even">Raises</dt>
  1404. <dd class="field-even"><p><strong>Exception</strong> – An exception is always raised to signal the abortion the
  1405. RPC to the gRPC runtime.</p>
  1406. </dd>
  1407. </dl>
  1408. </dd></dl>
  1409. <dl class="py method">
  1410. <dt id="grpc.ServicerContext.auth_context">
  1411. <em class="property">abstract </em><code class="sig-name descname">auth_context</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.auth_context"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.auth_context" title="Permalink to this definition">¶</a></dt>
  1412. <dd><p>Gets the auth context for the call.</p>
  1413. <dl class="field-list simple">
  1414. <dt class="field-odd">Returns</dt>
  1415. <dd class="field-odd"><p>A map of strings to an iterable of bytes for each auth property.</p>
  1416. </dd>
  1417. </dl>
  1418. </dd></dl>
  1419. <dl class="py method">
  1420. <dt id="grpc.ServicerContext.disable_next_message_compression">
  1421. <code class="sig-name descname">disable_next_message_compression</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.disable_next_message_compression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.disable_next_message_compression" title="Permalink to this definition">¶</a></dt>
  1422. <dd><p>Disables compression for the next response message.</p>
  1423. <p>This is an EXPERIMENTAL method.</p>
  1424. <p>This method will override any compression configuration set during
  1425. server creation or set on the call.</p>
  1426. </dd></dl>
  1427. <dl class="py method">
  1428. <dt id="grpc.ServicerContext.invocation_metadata">
  1429. <em class="property">abstract </em><code class="sig-name descname">invocation_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.invocation_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.invocation_metadata" title="Permalink to this definition">¶</a></dt>
  1430. <dd><p>Accesses the metadata from the sent by the client.</p>
  1431. <dl class="field-list simple">
  1432. <dt class="field-odd">Returns</dt>
  1433. <dd class="field-odd"><p>The invocation <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1434. </dd>
  1435. </dl>
  1436. </dd></dl>
  1437. <dl class="py method">
  1438. <dt id="grpc.ServicerContext.peer">
  1439. <em class="property">abstract </em><code class="sig-name descname">peer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.peer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.peer" title="Permalink to this definition">¶</a></dt>
  1440. <dd><p>Identifies the peer that invoked the RPC being serviced.</p>
  1441. <dl class="field-list simple">
  1442. <dt class="field-odd">Returns</dt>
  1443. <dd class="field-odd"><p>A string identifying the peer that invoked the RPC being serviced.
  1444. The string format is determined by gRPC runtime.</p>
  1445. </dd>
  1446. </dl>
  1447. </dd></dl>
  1448. <dl class="py method">
  1449. <dt id="grpc.ServicerContext.peer_identities">
  1450. <em class="property">abstract </em><code class="sig-name descname">peer_identities</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.peer_identities"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.peer_identities" title="Permalink to this definition">¶</a></dt>
  1451. <dd><p>Gets one or more peer identity(s).</p>
  1452. <p>Equivalent to
  1453. servicer_context.auth_context().get(servicer_context.peer_identity_key())</p>
  1454. <dl class="field-list simple">
  1455. <dt class="field-odd">Returns</dt>
  1456. <dd class="field-odd"><p>An iterable of the identities, or None if the call is not
  1457. authenticated. Each identity is returned as a raw bytes type.</p>
  1458. </dd>
  1459. </dl>
  1460. </dd></dl>
  1461. <dl class="py method">
  1462. <dt id="grpc.ServicerContext.peer_identity_key">
  1463. <em class="property">abstract </em><code class="sig-name descname">peer_identity_key</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.peer_identity_key"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.peer_identity_key" title="Permalink to this definition">¶</a></dt>
  1464. <dd><p>The auth property used to identify the peer.</p>
  1465. <p>For example, “x509_common_name” or “x509_subject_alternative_name” are
  1466. used to identify an SSL peer.</p>
  1467. <dl class="field-list simple">
  1468. <dt class="field-odd">Returns</dt>
  1469. <dd class="field-odd"><p>The auth property (string) that indicates the
  1470. peer identity, or None if the call is not authenticated.</p>
  1471. </dd>
  1472. </dl>
  1473. </dd></dl>
  1474. <dl class="py method">
  1475. <dt id="grpc.ServicerContext.send_initial_metadata">
  1476. <em class="property">abstract </em><code class="sig-name descname">send_initial_metadata</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">initial_metadata</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.send_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
  1477. <dd><p>Sends the initial metadata value to the client.</p>
  1478. <p>This method need not be called by implementations if they have no
  1479. metadata to add to what the gRPC runtime will transmit.</p>
  1480. <dl class="field-list simple">
  1481. <dt class="field-odd">Parameters</dt>
  1482. <dd class="field-odd"><p><strong>initial_metadata</strong> – The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1483. </dd>
  1484. </dl>
  1485. </dd></dl>
  1486. <dl class="py method">
  1487. <dt id="grpc.ServicerContext.set_code">
  1488. <em class="property">abstract </em><code class="sig-name descname">set_code</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">code</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_code" title="Permalink to this definition">¶</a></dt>
  1489. <dd><p>Sets the value to be used as status code upon RPC completion.</p>
  1490. <p>This method need not be called by method implementations if they wish
  1491. the gRPC runtime to determine the status code of the RPC.</p>
  1492. <dl class="field-list simple">
  1493. <dt class="field-odd">Parameters</dt>
  1494. <dd class="field-odd"><p><strong>code</strong> – A StatusCode object to be sent to the client.</p>
  1495. </dd>
  1496. </dl>
  1497. </dd></dl>
  1498. <dl class="py method">
  1499. <dt id="grpc.ServicerContext.set_compression">
  1500. <code class="sig-name descname">set_compression</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">compression</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_compression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_compression" title="Permalink to this definition">¶</a></dt>
  1501. <dd><p>Set the compression algorithm to be used for the entire call.</p>
  1502. <p>This is an EXPERIMENTAL method.</p>
  1503. <dl class="field-list simple">
  1504. <dt class="field-odd">Parameters</dt>
  1505. <dd class="field-odd"><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1506. grpc.compression.Gzip.</p>
  1507. </dd>
  1508. </dl>
  1509. </dd></dl>
  1510. <dl class="py method">
  1511. <dt id="grpc.ServicerContext.set_details">
  1512. <em class="property">abstract </em><code class="sig-name descname">set_details</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_details"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_details" title="Permalink to this definition">¶</a></dt>
  1513. <dd><p>Sets the value to be used as detail string upon RPC completion.</p>
  1514. <p>This method need not be called by method implementations if they have
  1515. no details to transmit.</p>
  1516. <dl class="field-list simple">
  1517. <dt class="field-odd">Parameters</dt>
  1518. <dd class="field-odd"><p><strong>details</strong> – A UTF-8-encodable string to be sent to the client upon
  1519. termination of the RPC.</p>
  1520. </dd>
  1521. </dl>
  1522. </dd></dl>
  1523. <dl class="py method">
  1524. <dt id="grpc.ServicerContext.set_trailing_metadata">
  1525. <em class="property">abstract </em><code class="sig-name descname">set_trailing_metadata</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">trailing_metadata</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServicerContext.set_trailing_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServicerContext.set_trailing_metadata" title="Permalink to this definition">¶</a></dt>
  1526. <dd><p>Sets the trailing metadata for the RPC.</p>
  1527. <p>Sets the trailing metadata to be sent upon completion of the RPC.</p>
  1528. <p>If this method is invoked multiple times throughout the lifetime of an
  1529. RPC, the value supplied in the final invocation will be the value sent
  1530. over the wire.</p>
  1531. <p>This method need not be called by implementations if they have no
  1532. metadata to add to what the gRPC runtime will transmit.</p>
  1533. <dl class="field-list simple">
  1534. <dt class="field-odd">Parameters</dt>
  1535. <dd class="field-odd"><p><strong>trailing_metadata</strong> – The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1536. </dd>
  1537. </dl>
  1538. </dd></dl>
  1539. </dd></dl>
  1540. </div>
  1541. <div class="section" id="service-side-handler">
  1542. <h3>Service-Side Handler<a class="headerlink" href="#service-side-handler" title="Permalink to this headline">¶</a></h3>
  1543. <dl class="py class">
  1544. <dt id="grpc.RpcMethodHandler">
  1545. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">RpcMethodHandler</code><a class="reference internal" href="_modules/grpc.html#RpcMethodHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.RpcMethodHandler" title="Permalink to this definition">¶</a></dt>
  1546. <dd><p>An implementation of a single RPC method.</p>
  1547. <dl class="py attribute">
  1548. <dt id="grpc.RpcMethodHandler.request_streaming">
  1549. <code class="sig-name descname">request_streaming</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_streaming" title="Permalink to this definition">¶</a></dt>
  1550. <dd><p>Whether the RPC supports exactly one request message
  1551. or any arbitrary number of request messages.</p>
  1552. </dd></dl>
  1553. <dl class="py attribute">
  1554. <dt id="grpc.RpcMethodHandler.response_streaming">
  1555. <code class="sig-name descname">response_streaming</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_streaming" title="Permalink to this definition">¶</a></dt>
  1556. <dd><p>Whether the RPC supports exactly one response message
  1557. or any arbitrary number of response messages.</p>
  1558. </dd></dl>
  1559. <dl class="py attribute">
  1560. <dt id="grpc.RpcMethodHandler.request_deserializer">
  1561. <code class="sig-name descname">request_deserializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_deserializer" title="Permalink to this definition">¶</a></dt>
  1562. <dd><p>A callable <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> that accepts a byte string and
  1563. returns an object suitable to be passed to this object’s business
  1564. logic, or None to indicate that this object’s business logic should be
  1565. passed the raw request bytes.</p>
  1566. </dd></dl>
  1567. <dl class="py attribute">
  1568. <dt id="grpc.RpcMethodHandler.response_serializer">
  1569. <code class="sig-name descname">response_serializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_serializer" title="Permalink to this definition">¶</a></dt>
  1570. <dd><p>A callable <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> that accepts an object produced
  1571. by this object’s business logic and returns a byte string, or None to
  1572. indicate that the byte strings produced by this object’s business logic
  1573. should be transmitted on the wire as they are.</p>
  1574. </dd></dl>
  1575. <dl class="py attribute">
  1576. <dt id="grpc.RpcMethodHandler.unary_unary">
  1577. <code class="sig-name descname">unary_unary</code><a class="headerlink" href="#grpc.RpcMethodHandler.unary_unary" title="Permalink to this definition">¶</a></dt>
  1578. <dd><p>This object’s application-specific business logic as a
  1579. callable value that takes a request value and a ServicerContext object
  1580. and returns a response value. Only non-None if both request_streaming
  1581. and response_streaming are False.</p>
  1582. </dd></dl>
  1583. <dl class="py attribute">
  1584. <dt id="grpc.RpcMethodHandler.unary_stream">
  1585. <code class="sig-name descname">unary_stream</code><a class="headerlink" href="#grpc.RpcMethodHandler.unary_stream" title="Permalink to this definition">¶</a></dt>
  1586. <dd><p>This object’s application-specific business logic as a
  1587. callable value that takes a request value and a ServicerContext object
  1588. and returns an iterator of response values. Only non-None if
  1589. request_streaming is False and response_streaming is True.</p>
  1590. </dd></dl>
  1591. <dl class="py attribute">
  1592. <dt id="grpc.RpcMethodHandler.stream_unary">
  1593. <code class="sig-name descname">stream_unary</code><a class="headerlink" href="#grpc.RpcMethodHandler.stream_unary" title="Permalink to this definition">¶</a></dt>
  1594. <dd><p>This object’s application-specific business logic as a
  1595. callable value that takes an iterator of request values and a
  1596. ServicerContext object and returns a response value. Only non-None if
  1597. request_streaming is True and response_streaming is False.</p>
  1598. </dd></dl>
  1599. <dl class="py attribute">
  1600. <dt id="grpc.RpcMethodHandler.stream_stream">
  1601. <code class="sig-name descname">stream_stream</code><a class="headerlink" href="#grpc.RpcMethodHandler.stream_stream" title="Permalink to this definition">¶</a></dt>
  1602. <dd><p>This object’s application-specific business logic as a
  1603. callable value that takes an iterator of request values and a
  1604. ServicerContext object and returns an iterator of response values.
  1605. Only non-None if request_streaming and response_streaming are both
  1606. True.</p>
  1607. </dd></dl>
  1608. </dd></dl>
  1609. <dl class="py class">
  1610. <dt id="grpc.HandlerCallDetails">
  1611. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">HandlerCallDetails</code><a class="reference internal" href="_modules/grpc.html#HandlerCallDetails"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.HandlerCallDetails" title="Permalink to this definition">¶</a></dt>
  1612. <dd><p>Describes an RPC that has just arrived for service.</p>
  1613. <dl class="py attribute">
  1614. <dt id="grpc.HandlerCallDetails.method">
  1615. <code class="sig-name descname">method</code><a class="headerlink" href="#grpc.HandlerCallDetails.method" title="Permalink to this definition">¶</a></dt>
  1616. <dd><p>The method name of the RPC.</p>
  1617. </dd></dl>
  1618. <dl class="py attribute">
  1619. <dt id="grpc.HandlerCallDetails.invocation_metadata">
  1620. <code class="sig-name descname">invocation_metadata</code><a class="headerlink" href="#grpc.HandlerCallDetails.invocation_metadata" title="Permalink to this definition">¶</a></dt>
  1621. <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>
  1622. </dd></dl>
  1623. </dd></dl>
  1624. <dl class="py class">
  1625. <dt id="grpc.GenericRpcHandler">
  1626. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">GenericRpcHandler</code><a class="reference internal" href="_modules/grpc.html#GenericRpcHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.GenericRpcHandler" title="Permalink to this definition">¶</a></dt>
  1627. <dd><p>An implementation of arbitrarily many RPC methods.</p>
  1628. <dl class="py method">
  1629. <dt id="grpc.GenericRpcHandler.service">
  1630. <em class="property">abstract </em><code class="sig-name descname">service</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">handler_call_details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#GenericRpcHandler.service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.GenericRpcHandler.service" title="Permalink to this definition">¶</a></dt>
  1631. <dd><p>Returns the handler for servicing the RPC.</p>
  1632. <dl class="field-list simple">
  1633. <dt class="field-odd">Parameters</dt>
  1634. <dd class="field-odd"><p><strong>handler_call_details</strong> – A HandlerCallDetails describing the RPC.</p>
  1635. </dd>
  1636. <dt class="field-even">Returns</dt>
  1637. <dd class="field-even"><p>An RpcMethodHandler with which the RPC may be serviced if the
  1638. implementation chooses to service this RPC, or None otherwise.</p>
  1639. </dd>
  1640. </dl>
  1641. </dd></dl>
  1642. </dd></dl>
  1643. <dl class="py class">
  1644. <dt id="grpc.ServiceRpcHandler">
  1645. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServiceRpcHandler</code><a class="reference internal" href="_modules/grpc.html#ServiceRpcHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServiceRpcHandler" title="Permalink to this definition">¶</a></dt>
  1646. <dd><p>An implementation of RPC methods belonging to a service.</p>
  1647. <p>A service handles RPC methods with structured names of the form
  1648. ‘/Service.Name/Service.Method’, where ‘Service.Name’ is the value
  1649. returned by service_name(), and ‘Service.Method’ is the method
  1650. name. A service can have multiple method names, but only a single
  1651. service name.</p>
  1652. <dl class="py method">
  1653. <dt id="grpc.ServiceRpcHandler.service_name">
  1654. <em class="property">abstract </em><code class="sig-name descname">service_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServiceRpcHandler.service_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServiceRpcHandler.service_name" title="Permalink to this definition">¶</a></dt>
  1655. <dd><p>Returns this service’s name.</p>
  1656. <dl class="field-list simple">
  1657. <dt class="field-odd">Returns</dt>
  1658. <dd class="field-odd"><p>The service name.</p>
  1659. </dd>
  1660. </dl>
  1661. </dd></dl>
  1662. </dd></dl>
  1663. </div>
  1664. <div class="section" id="service-side-interceptor">
  1665. <h3>Service-Side Interceptor<a class="headerlink" href="#service-side-interceptor" title="Permalink to this headline">¶</a></h3>
  1666. <dl class="py class">
  1667. <dt id="grpc.ServerInterceptor">
  1668. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">ServerInterceptor</code><a class="reference internal" href="_modules/grpc.html#ServerInterceptor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerInterceptor" title="Permalink to this definition">¶</a></dt>
  1669. <dd><p>Affords intercepting incoming RPCs on the service-side.</p>
  1670. <p>This is an EXPERIMENTAL API.</p>
  1671. <dl class="py method">
  1672. <dt id="grpc.ServerInterceptor.intercept_service">
  1673. <em class="property">abstract </em><code class="sig-name descname">intercept_service</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">continuation</span></em>, <em class="sig-param"><span class="n">handler_call_details</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#ServerInterceptor.intercept_service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.ServerInterceptor.intercept_service" title="Permalink to this definition">¶</a></dt>
  1674. <dd><p>Intercepts incoming RPCs before handing them over to a handler.</p>
  1675. <dl class="field-list simple">
  1676. <dt class="field-odd">Parameters</dt>
  1677. <dd class="field-odd"><ul class="simple">
  1678. <li><p><strong>continuation</strong> – A function that takes a HandlerCallDetails and
  1679. proceeds to invoke the next interceptor in the chain, if any,
  1680. or the RPC handler lookup logic, with the call details passed
  1681. as an argument, and returns an RpcMethodHandler instance if
  1682. the RPC is considered serviced, or None otherwise.</p></li>
  1683. <li><p><strong>handler_call_details</strong> – A HandlerCallDetails describing the RPC.</p></li>
  1684. </ul>
  1685. </dd>
  1686. <dt class="field-even">Returns</dt>
  1687. <dd class="field-even"><p>An RpcMethodHandler with which the RPC may be serviced if the
  1688. interceptor chooses to service this RPC, or None otherwise.</p>
  1689. </dd>
  1690. </dl>
  1691. </dd></dl>
  1692. </dd></dl>
  1693. </div>
  1694. <div class="section" id="multi-callable-interfaces">
  1695. <h3>Multi-Callable Interfaces<a class="headerlink" href="#multi-callable-interfaces" title="Permalink to this headline">¶</a></h3>
  1696. <dl class="py class">
  1697. <dt id="grpc.UnaryUnaryMultiCallable">
  1698. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryUnaryMultiCallable</code><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable" title="Permalink to this definition">¶</a></dt>
  1699. <dd><p>Affords invoking a unary-unary RPC from client-side.</p>
  1700. <dl class="py method">
  1701. <dt id="grpc.UnaryUnaryMultiCallable.__call__">
  1702. <em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1703. <dd><p>Synchronously invokes the underlying RPC.</p>
  1704. <dl class="field-list simple">
  1705. <dt class="field-odd">Parameters</dt>
  1706. <dd class="field-odd"><ul class="simple">
  1707. <li><p><strong>request</strong> – The request value for the RPC.</p></li>
  1708. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow
  1709. for the RPC.</p></li>
  1710. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1711. service-side of the RPC.</p></li>
  1712. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1713. secure Channel.</p></li>
  1714. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1715. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1716. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1717. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1718. </ul>
  1719. </dd>
  1720. <dt class="field-even">Returns</dt>
  1721. <dd class="field-even"><p>The response value for the RPC.</p>
  1722. </dd>
  1723. <dt class="field-odd">Raises</dt>
  1724. <dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
  1725. raised RpcError will also be a Call for the RPC affording the RPC’s
  1726. metadata, status code, and details.</p>
  1727. </dd>
  1728. </dl>
  1729. </dd></dl>
  1730. <dl class="py method">
  1731. <dt id="grpc.UnaryUnaryMultiCallable.future">
  1732. <em class="property">abstract </em><code class="sig-name descname">future</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable.future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable.future" title="Permalink to this definition">¶</a></dt>
  1733. <dd><p>Asynchronously invokes the underlying RPC.</p>
  1734. <dl class="field-list simple">
  1735. <dt class="field-odd">Parameters</dt>
  1736. <dd class="field-odd"><ul class="simple">
  1737. <li><p><strong>request</strong> – The request value for the RPC.</p></li>
  1738. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
  1739. the RPC.</p></li>
  1740. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1741. service-side of the RPC.</p></li>
  1742. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1743. secure Channel.</p></li>
  1744. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1745. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1746. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1747. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1748. </ul>
  1749. </dd>
  1750. <dt class="field-even">Returns</dt>
  1751. <dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
  1752. In the event of RPC completion, the return Call-Future’s result
  1753. value will be the response message of the RPC.
  1754. Should the event terminate with non-OK status,
  1755. the returned Call-Future’s exception value will be an RpcError.</p>
  1756. </dd>
  1757. </dl>
  1758. </dd></dl>
  1759. <dl class="py method">
  1760. <dt id="grpc.UnaryUnaryMultiCallable.with_call">
  1761. <em class="property">abstract </em><code class="sig-name descname">with_call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryUnaryMultiCallable.with_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryUnaryMultiCallable.with_call" title="Permalink to this definition">¶</a></dt>
  1762. <dd><p>Synchronously invokes the underlying RPC.</p>
  1763. <dl class="field-list simple">
  1764. <dt class="field-odd">Parameters</dt>
  1765. <dd class="field-odd"><ul class="simple">
  1766. <li><p><strong>request</strong> – The request value for the RPC.</p></li>
  1767. <li><p><strong>timeout</strong> – An optional durating of time in seconds to allow for
  1768. the RPC.</p></li>
  1769. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1770. service-side of the RPC.</p></li>
  1771. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1772. secure Channel.</p></li>
  1773. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1774. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1775. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1776. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1777. </ul>
  1778. </dd>
  1779. <dt class="field-even">Returns</dt>
  1780. <dd class="field-even"><p>The response value for the RPC and a Call value for the RPC.</p>
  1781. </dd>
  1782. <dt class="field-odd">Raises</dt>
  1783. <dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
  1784. raised RpcError will also be a Call for the RPC affording the RPC’s
  1785. metadata, status code, and details.</p>
  1786. </dd>
  1787. </dl>
  1788. </dd></dl>
  1789. </dd></dl>
  1790. <dl class="py class">
  1791. <dt id="grpc.UnaryStreamMultiCallable">
  1792. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">UnaryStreamMultiCallable</code><a class="reference internal" href="_modules/grpc.html#UnaryStreamMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamMultiCallable" title="Permalink to this definition">¶</a></dt>
  1793. <dd><p>Affords invoking a unary-stream RPC from client-side.</p>
  1794. <dl class="py method">
  1795. <dt id="grpc.UnaryStreamMultiCallable.__call__">
  1796. <em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#UnaryStreamMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.UnaryStreamMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1797. <dd><p>Invokes the underlying RPC.</p>
  1798. <dl class="field-list simple">
  1799. <dt class="field-odd">Parameters</dt>
  1800. <dd class="field-odd"><ul class="simple">
  1801. <li><p><strong>request</strong> – The request value for the RPC.</p></li>
  1802. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
  1803. the RPC. If None, the timeout is considered infinite.</p></li>
  1804. <li><p><strong>metadata</strong> – An optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1805. service-side of the RPC.</p></li>
  1806. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1807. secure Channel.</p></li>
  1808. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1809. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1810. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1811. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1812. </ul>
  1813. </dd>
  1814. <dt class="field-even">Returns</dt>
  1815. <dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
  1816. response values. Drawing response values from the returned
  1817. Call-iterator may raise RpcError indicating termination of the
  1818. RPC with non-OK status.</p>
  1819. </dd>
  1820. </dl>
  1821. </dd></dl>
  1822. </dd></dl>
  1823. <dl class="py class">
  1824. <dt id="grpc.StreamUnaryMultiCallable">
  1825. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamUnaryMultiCallable</code><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable" title="Permalink to this definition">¶</a></dt>
  1826. <dd><p>Affords invoking a stream-unary RPC from client-side.</p>
  1827. <dl class="py method">
  1828. <dt id="grpc.StreamUnaryMultiCallable.__call__">
  1829. <em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1830. <dd><p>Synchronously invokes the underlying RPC.</p>
  1831. <dl class="field-list simple">
  1832. <dt class="field-odd">Parameters</dt>
  1833. <dd class="field-odd"><ul class="simple">
  1834. <li><p><strong>request_iterator</strong> – An iterator that yields request values for
  1835. the RPC.</p></li>
  1836. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
  1837. the RPC. If None, the timeout is considered infinite.</p></li>
  1838. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1839. service-side of the RPC.</p></li>
  1840. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1841. secure Channel.</p></li>
  1842. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1843. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1844. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1845. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1846. </ul>
  1847. </dd>
  1848. <dt class="field-even">Returns</dt>
  1849. <dd class="field-even"><p>The response value for the RPC.</p>
  1850. </dd>
  1851. <dt class="field-odd">Raises</dt>
  1852. <dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
  1853. raised RpcError will also implement grpc.Call, affording methods
  1854. such as metadata, code, and details.</p>
  1855. </dd>
  1856. </dl>
  1857. </dd></dl>
  1858. <dl class="py method">
  1859. <dt id="grpc.StreamUnaryMultiCallable.future">
  1860. <em class="property">abstract </em><code class="sig-name descname">future</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable.future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable.future" title="Permalink to this definition">¶</a></dt>
  1861. <dd><p>Asynchronously invokes the underlying RPC on the client.</p>
  1862. <dl class="field-list simple">
  1863. <dt class="field-odd">Parameters</dt>
  1864. <dd class="field-odd"><ul class="simple">
  1865. <li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
  1866. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
  1867. the RPC. If None, the timeout is considered infinite.</p></li>
  1868. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1869. service-side of the RPC.</p></li>
  1870. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1871. secure Channel.</p></li>
  1872. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1873. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1874. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1875. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1876. </ul>
  1877. </dd>
  1878. <dt class="field-even">Returns</dt>
  1879. <dd class="field-even"><p>An object that is both a Call for the RPC and a Future.
  1880. In the event of RPC completion, the return Call-Future’s result value
  1881. will be the response message of the RPC. Should the event terminate
  1882. with non-OK status, the returned Call-Future’s exception value will
  1883. be an RpcError.</p>
  1884. </dd>
  1885. </dl>
  1886. </dd></dl>
  1887. <dl class="py method">
  1888. <dt id="grpc.StreamUnaryMultiCallable.with_call">
  1889. <em class="property">abstract </em><code class="sig-name descname">with_call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamUnaryMultiCallable.with_call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamUnaryMultiCallable.with_call" title="Permalink to this definition">¶</a></dt>
  1890. <dd><p>Synchronously invokes the underlying RPC on the client.</p>
  1891. <dl class="field-list simple">
  1892. <dt class="field-odd">Parameters</dt>
  1893. <dd class="field-odd"><ul class="simple">
  1894. <li><p><strong>request_iterator</strong> – An iterator that yields request values for
  1895. the RPC.</p></li>
  1896. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
  1897. the RPC. If None, the timeout is considered infinite.</p></li>
  1898. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1899. service-side of the RPC.</p></li>
  1900. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1901. secure Channel.</p></li>
  1902. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1903. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1904. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1905. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1906. </ul>
  1907. </dd>
  1908. <dt class="field-even">Returns</dt>
  1909. <dd class="field-even"><p>The response value for the RPC and a Call object for the RPC.</p>
  1910. </dd>
  1911. <dt class="field-odd">Raises</dt>
  1912. <dd class="field-odd"><p><a class="reference internal" href="#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicating that the RPC terminated with non-OK status. The
  1913. raised RpcError will also be a Call for the RPC affording the RPC’s
  1914. metadata, status code, and details.</p>
  1915. </dd>
  1916. </dl>
  1917. </dd></dl>
  1918. </dd></dl>
  1919. <dl class="py class">
  1920. <dt id="grpc.StreamStreamMultiCallable">
  1921. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">StreamStreamMultiCallable</code><a class="reference internal" href="_modules/grpc.html#StreamStreamMultiCallable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamMultiCallable" title="Permalink to this definition">¶</a></dt>
  1922. <dd><p>Affords invoking a stream-stream RPC on client-side.</p>
  1923. <dl class="py method">
  1924. <dt id="grpc.StreamStreamMultiCallable.__call__">
  1925. <em class="property">abstract </em><code class="sig-name descname">__call__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">request_iterator</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">metadata</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">credentials</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">wait_for_ready</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">compression</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#StreamStreamMultiCallable.__call__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.StreamStreamMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1926. <dd><p>Invokes the underlying RPC on the client.</p>
  1927. <dl class="field-list simple">
  1928. <dt class="field-odd">Parameters</dt>
  1929. <dd class="field-odd"><ul class="simple">
  1930. <li><p><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</p></li>
  1931. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for
  1932. the RPC. If not specified, the timeout is considered infinite.</p></li>
  1933. <li><p><strong>metadata</strong> – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1934. service-side of the RPC.</p></li>
  1935. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC. Only valid for
  1936. secure Channel.</p></li>
  1937. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1938. flag to enable <a class="reference internal" href="glossary.html#term-wait_for_ready"><span class="xref std std-term">wait_for_ready</span></a> mechanism.</p></li>
  1939. <li><p><strong>compression</strong> – An element of grpc.compression, e.g.
  1940. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1941. </ul>
  1942. </dd>
  1943. <dt class="field-even">Returns</dt>
  1944. <dd class="field-even"><p>An object that is both a Call for the RPC and an iterator of
  1945. response values. Drawing response values from the returned
  1946. Call-iterator may raise RpcError indicating termination of the
  1947. RPC with non-OK status.</p>
  1948. </dd>
  1949. </dl>
  1950. </dd></dl>
  1951. </dd></dl>
  1952. </div>
  1953. <div class="section" id="future-interfaces">
  1954. <h3>Future Interfaces<a class="headerlink" href="#future-interfaces" title="Permalink to this headline">¶</a></h3>
  1955. <dl class="py exception">
  1956. <dt id="grpc.FutureTimeoutError">
  1957. <em class="property">exception </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">FutureTimeoutError</code><a class="reference internal" href="_modules/grpc.html#FutureTimeoutError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.FutureTimeoutError" title="Permalink to this definition">¶</a></dt>
  1958. <dd><p>Indicates that a method call on a Future timed out.</p>
  1959. </dd></dl>
  1960. <dl class="py exception">
  1961. <dt id="grpc.FutureCancelledError">
  1962. <em class="property">exception </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">FutureCancelledError</code><a class="reference internal" href="_modules/grpc.html#FutureCancelledError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.FutureCancelledError" title="Permalink to this definition">¶</a></dt>
  1963. <dd><p>Indicates that the computation underlying a Future was cancelled.</p>
  1964. </dd></dl>
  1965. <dl class="py class">
  1966. <dt id="grpc.Future">
  1967. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Future</code><a class="reference internal" href="_modules/grpc.html#Future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future" title="Permalink to this definition">¶</a></dt>
  1968. <dd><p>A representation of a computation in another control flow.</p>
  1969. <p>Computations represented by a Future may be yet to be begun,
  1970. may be ongoing, or may have already completed.</p>
  1971. <dl class="py method">
  1972. <dt id="grpc.Future.add_done_callback">
  1973. <em class="property">abstract </em><code class="sig-name descname">add_done_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">fn</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.add_done_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.add_done_callback" title="Permalink to this definition">¶</a></dt>
  1974. <dd><p>Adds a function to be called at completion of the computation.</p>
  1975. <p>The callback will be passed this Future object describing the outcome
  1976. of the computation. Callbacks will be invoked after the future is
  1977. terminated, whether successfully or not.</p>
  1978. <p>If the computation has already completed, the callback will be called
  1979. immediately.</p>
  1980. <p>Exceptions raised in the callback will be logged at ERROR level, but
  1981. will not terminate any threads of execution.</p>
  1982. <dl class="field-list simple">
  1983. <dt class="field-odd">Parameters</dt>
  1984. <dd class="field-odd"><p><strong>fn</strong> – A callable taking this Future object as its single parameter.</p>
  1985. </dd>
  1986. </dl>
  1987. </dd></dl>
  1988. <dl class="py method">
  1989. <dt id="grpc.Future.cancel">
  1990. <em class="property">abstract </em><code class="sig-name descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.cancel" title="Permalink to this definition">¶</a></dt>
  1991. <dd><p>Attempts to cancel the computation.</p>
  1992. <p>This method does not block.</p>
  1993. <dl class="field-list simple">
  1994. <dt class="field-odd">Returns</dt>
  1995. <dd class="field-odd"><p><p>Returns True if the computation was canceled.</p>
  1996. <p>Returns False under all other circumstances, for example:</p>
  1997. <ol class="arabic simple">
  1998. <li><p>computation has begun and could not be canceled.</p></li>
  1999. <li><p>computation has finished</p></li>
  2000. <li><dl class="simple">
  2001. <dt>computation is scheduled for execution and it is impossible</dt><dd><p>to determine its state without blocking.</p>
  2002. </dd>
  2003. </dl>
  2004. </li>
  2005. </ol>
  2006. </p>
  2007. </dd>
  2008. <dt class="field-even">Return type</dt>
  2009. <dd class="field-even"><p>bool</p>
  2010. </dd>
  2011. </dl>
  2012. </dd></dl>
  2013. <dl class="py method">
  2014. <dt id="grpc.Future.cancelled">
  2015. <em class="property">abstract </em><code class="sig-name descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.cancelled" title="Permalink to this definition">¶</a></dt>
  2016. <dd><p>Describes whether the computation was cancelled.</p>
  2017. <p>This method does not block.</p>
  2018. <dl class="field-list simple">
  2019. <dt class="field-odd">Returns</dt>
  2020. <dd class="field-odd"><p><p>Returns True if the computation was cancelled before its result became
  2021. available.</p>
  2022. <p>Returns False under all other circumstances, for example:</p>
  2023. <ol class="arabic simple">
  2024. <li><p>computation was not cancelled.</p></li>
  2025. <li><p>computation’s result is available.</p></li>
  2026. </ol>
  2027. </p>
  2028. </dd>
  2029. <dt class="field-even">Return type</dt>
  2030. <dd class="field-even"><p>bool</p>
  2031. </dd>
  2032. </dl>
  2033. </dd></dl>
  2034. <dl class="py method">
  2035. <dt id="grpc.Future.done">
  2036. <em class="property">abstract </em><code class="sig-name descname">done</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.done"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.done" title="Permalink to this definition">¶</a></dt>
  2037. <dd><p>Describes whether the computation has taken place.</p>
  2038. <p>This method does not block.</p>
  2039. <dl class="field-list simple">
  2040. <dt class="field-odd">Returns</dt>
  2041. <dd class="field-odd"><p>Returns True if the computation already executed or was cancelled.
  2042. Returns False if the computation is scheduled for execution or
  2043. currently executing.
  2044. This is exactly opposite of the running() method’s result.</p>
  2045. </dd>
  2046. <dt class="field-even">Return type</dt>
  2047. <dd class="field-even"><p>bool</p>
  2048. </dd>
  2049. </dl>
  2050. </dd></dl>
  2051. <dl class="py method">
  2052. <dt id="grpc.Future.exception">
  2053. <em class="property">abstract </em><code class="sig-name descname">exception</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.exception" title="Permalink to this definition">¶</a></dt>
  2054. <dd><p>Return the exception raised by the computation.</p>
  2055. <p>This method may return immediately or may block.</p>
  2056. <dl class="field-list simple">
  2057. <dt class="field-odd">Parameters</dt>
  2058. <dd class="field-odd"><p><strong>timeout</strong> – The length of time in seconds to wait for the computation to
  2059. terminate or be cancelled. If None, the call will block until the
  2060. computations’s termination.</p>
  2061. </dd>
  2062. <dt class="field-even">Returns</dt>
  2063. <dd class="field-even"><p>The exception raised by the computation, or None if the computation
  2064. did not raise an exception.</p>
  2065. </dd>
  2066. <dt class="field-odd">Raises</dt>
  2067. <dd class="field-odd"><ul class="simple">
  2068. <li><p><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><strong>FutureTimeoutError</strong></a> – If a timeout value is passed and the computation
  2069. does not terminate within the allotted time.</p></li>
  2070. <li><p><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><strong>FutureCancelledError</strong></a> – If the computation was cancelled.</p></li>
  2071. </ul>
  2072. </dd>
  2073. </dl>
  2074. </dd></dl>
  2075. <dl class="py method">
  2076. <dt id="grpc.Future.result">
  2077. <em class="property">abstract </em><code class="sig-name descname">result</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.result"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.result" title="Permalink to this definition">¶</a></dt>
  2078. <dd><p>Returns the result of the computation or raises its exception.</p>
  2079. <p>This method may return immediately or may block.</p>
  2080. <dl class="field-list simple">
  2081. <dt class="field-odd">Parameters</dt>
  2082. <dd class="field-odd"><p><strong>timeout</strong> – The length of time in seconds to wait for the computation to
  2083. finish or be cancelled. If None, the call will block until the
  2084. computations’s termination.</p>
  2085. </dd>
  2086. <dt class="field-even">Returns</dt>
  2087. <dd class="field-even"><p>The return value of the computation.</p>
  2088. </dd>
  2089. <dt class="field-odd">Raises</dt>
  2090. <dd class="field-odd"><ul class="simple">
  2091. <li><p><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><strong>FutureTimeoutError</strong></a> – If a timeout value is passed and the computation
  2092. does not terminate within the allotted time.</p></li>
  2093. <li><p><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><strong>FutureCancelledError</strong></a> – If the computation was cancelled.</p></li>
  2094. <li><p><strong>Exception</strong> – If the computation raised an exception, this call will
  2095. raise the same exception.</p></li>
  2096. </ul>
  2097. </dd>
  2098. </dl>
  2099. </dd></dl>
  2100. <dl class="py method">
  2101. <dt id="grpc.Future.running">
  2102. <em class="property">abstract </em><code class="sig-name descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.running"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.running" title="Permalink to this definition">¶</a></dt>
  2103. <dd><p>Describes whether the computation is taking place.</p>
  2104. <p>This method does not block.</p>
  2105. <dl class="field-list simple">
  2106. <dt class="field-odd">Returns</dt>
  2107. <dd class="field-odd"><p><p>Returns True if the computation is scheduled for execution or
  2108. currently executing.</p>
  2109. <p>Returns False if the computation already executed or was cancelled.</p>
  2110. </p>
  2111. </dd>
  2112. </dl>
  2113. </dd></dl>
  2114. <dl class="py method">
  2115. <dt id="grpc.Future.traceback">
  2116. <em class="property">abstract </em><code class="sig-name descname">traceback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Future.traceback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Future.traceback" title="Permalink to this definition">¶</a></dt>
  2117. <dd><p>Access the traceback of the exception raised by the computation.</p>
  2118. <p>This method may return immediately or may block.</p>
  2119. <dl class="field-list simple">
  2120. <dt class="field-odd">Parameters</dt>
  2121. <dd class="field-odd"><p><strong>timeout</strong> – The length of time in seconds to wait for the computation
  2122. to terminate or be cancelled. If None, the call will block until
  2123. the computation’s termination.</p>
  2124. </dd>
  2125. <dt class="field-even">Returns</dt>
  2126. <dd class="field-even"><p>The traceback of the exception raised by the computation, or None
  2127. if the computation did not raise an exception.</p>
  2128. </dd>
  2129. <dt class="field-odd">Raises</dt>
  2130. <dd class="field-odd"><ul class="simple">
  2131. <li><p><a class="reference internal" href="#grpc.FutureTimeoutError" title="grpc.FutureTimeoutError"><strong>FutureTimeoutError</strong></a> – If a timeout value is passed and the computation
  2132. does not terminate within the allotted time.</p></li>
  2133. <li><p><a class="reference internal" href="#grpc.FutureCancelledError" title="grpc.FutureCancelledError"><strong>FutureCancelledError</strong></a> – If the computation was cancelled.</p></li>
  2134. </ul>
  2135. </dd>
  2136. </dl>
  2137. </dd></dl>
  2138. </dd></dl>
  2139. </div>
  2140. <div class="section" id="compression">
  2141. <h3>Compression<a class="headerlink" href="#compression" title="Permalink to this headline">¶</a></h3>
  2142. <dl class="py class">
  2143. <dt id="grpc.Compression">
  2144. <em class="property">class </em><code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">Compression</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc.html#Compression"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.Compression" title="Permalink to this definition">¶</a></dt>
  2145. <dd><p>Indicates the compression method to be used for an RPC.</p>
  2146. <p>This enumeration is part of an EXPERIMENTAL API.</p>
  2147. <dl class="py attribute">
  2148. <dt id="grpc.Compression.NoCompression">
  2149. <code class="sig-name descname">NoCompression</code><a class="headerlink" href="#grpc.Compression.NoCompression" title="Permalink to this definition">¶</a></dt>
  2150. <dd><p>Do not use compression algorithm.</p>
  2151. </dd></dl>
  2152. <dl class="py attribute">
  2153. <dt id="grpc.Compression.Deflate">
  2154. <code class="sig-name descname">Deflate</code><a class="headerlink" href="#grpc.Compression.Deflate" title="Permalink to this definition">¶</a></dt>
  2155. <dd><p>Use “Deflate” compression algorithm.</p>
  2156. </dd></dl>
  2157. <dl class="py attribute">
  2158. <dt id="grpc.Compression.Gzip">
  2159. <code class="sig-name descname">Gzip</code><a class="headerlink" href="#grpc.Compression.Gzip" title="Permalink to this definition">¶</a></dt>
  2160. <dd><p>Use “Gzip” compression algorithm.</p>
  2161. </dd></dl>
  2162. </dd></dl>
  2163. </div>
  2164. <div class="section" id="runtime-protobuf-parsing">
  2165. <h3>Runtime Protobuf Parsing<a class="headerlink" href="#runtime-protobuf-parsing" title="Permalink to this headline">¶</a></h3>
  2166. <dl class="py function">
  2167. <dt id="grpc.protos">
  2168. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">protos</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">protobuf_path</span></em><span class="sig-paren">)</span><a class="headerlink" href="#grpc.protos" title="Permalink to this definition">¶</a></dt>
  2169. <dd><p>Returns a gRPC module generated from the indicated proto file.</p>
  2170. </dd></dl>
  2171. <dl class="py function">
  2172. <dt id="grpc.services">
  2173. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">services</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">protobuf_path</span></em><span class="sig-paren">)</span><a class="headerlink" href="#grpc.services" title="Permalink to this definition">¶</a></dt>
  2174. <dd><p>Returns a module generated from the indicated proto file.</p>
  2175. </dd></dl>
  2176. <dl class="py function">
  2177. <dt id="grpc.protos_and_services">
  2178. <code class="sig-prename descclassname">grpc.</code><code class="sig-name descname">protos_and_services</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">protobuf_path</span></em><span class="sig-paren">)</span><a class="headerlink" href="#grpc.protos_and_services" title="Permalink to this definition">¶</a></dt>
  2179. <dd><p>Returns two modules, corresponding to _pb2.py and _pb2_grpc.py files.</p>
  2180. </dd></dl>
  2181. </div>
  2182. </div>
  2183. </div>
  2184. </div>
  2185. </div>
  2186. </div>
  2187. <div class="clearer"></div>
  2188. </div>
  2189. <div class="footer">
  2190. &copy;2020, The gRPC Authors.
  2191. |
  2192. <a href="_sources/grpc.rst.txt"
  2193. rel="nofollow">Page source</a>
  2194. </div>
  2195. <script type="text/javascript">
  2196. var _gaq = _gaq || [];
  2197. _gaq.push(['_setAccount', 'UA-60127042-1']);
  2198. _gaq.push(['_setDomainName', 'none']);
  2199. _gaq.push(['_setAllowLinker', true]);
  2200. _gaq.push(['_trackPageview']);
  2201. (function() {
  2202. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  2203. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  2204. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  2205. })();
  2206. </script>
  2207. </body>
  2208. </html>