grpc.html 183 KB

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