grpc.html 160 KB

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