grpc.html 156 KB

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