grpc_asyncio.html 135 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741
  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 AsyncIO API &#8212; gRPC Python 1.36.1 documentation</title>
  7. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
  9. <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  10. <script src="_static/jquery.js"></script>
  11. <script src="_static/underscore.js"></script>
  12. <script src="_static/doctools.js"></script>
  13. <link rel="index" title="Index" href="genindex.html" />
  14. <link rel="search" title="Search" href="search.html" />
  15. <link rel="next" title="gRPC Channelz" href="grpc_channelz.html" />
  16. <link rel="prev" title="gRPC" href="grpc.html" />
  17. <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  18. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
  19. </head><body>
  20. <div class="document">
  21. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  22. <div class="sphinxsidebarwrapper">
  23. <h1 class="logo"><a href="index.html">gRPC Python</a></h1>
  24. <p class="blurb">1.36.1</p>
  25. <h3>Navigation</h3>
  26. <p class="caption"><span class="caption-text">Contents:</span></p>
  27. <ul class="current">
  28. <li class="toctree-l1"><a class="reference internal" href="grpc.html">gRPC</a></li>
  29. <li class="toctree-l1 current"><a class="current reference internal" href="#">gRPC AsyncIO API</a><ul>
  30. <li class="toctree-l2"><a class="reference internal" href="#overview">Overview</a></li>
  31. <li class="toctree-l2"><a class="reference internal" href="#caveats">Caveats</a></li>
  32. <li class="toctree-l2"><a class="reference internal" href="#blocking-code-in-asyncio">Blocking Code in AsyncIO</a></li>
  33. <li class="toctree-l2"><a class="reference internal" href="#module-contents">Module Contents</a><ul>
  34. <li class="toctree-l3"><a class="reference internal" href="#create-channel">Create Channel</a></li>
  35. <li class="toctree-l3"><a class="reference internal" href="#channel-object">Channel Object</a></li>
  36. <li class="toctree-l3"><a class="reference internal" href="#create-server">Create Server</a></li>
  37. <li class="toctree-l3"><a class="reference internal" href="#server-object">Server Object</a></li>
  38. <li class="toctree-l3"><a class="reference internal" href="#grpc-exceptions">gRPC Exceptions</a></li>
  39. <li class="toctree-l3"><a class="reference internal" href="#shared-context">Shared Context</a></li>
  40. <li class="toctree-l3"><a class="reference internal" href="#client-side-context">Client-Side Context</a></li>
  41. <li class="toctree-l3"><a class="reference internal" href="#server-side-context">Server-Side Context</a></li>
  42. <li class="toctree-l3"><a class="reference internal" href="#client-side-interceptor">Client-Side Interceptor</a></li>
  43. <li class="toctree-l3"><a class="reference internal" href="#server-side-interceptor">Server-Side Interceptor</a></li>
  44. <li class="toctree-l3"><a class="reference internal" href="#multi-callable-interfaces">Multi-Callable Interfaces</a></li>
  45. </ul>
  46. </li>
  47. </ul>
  48. </li>
  49. <li class="toctree-l1"><a class="reference internal" href="grpc_channelz.html">gRPC Channelz</a></li>
  50. <li class="toctree-l1"><a class="reference internal" href="grpc_health_checking.html">gRPC Health Checking</a></li>
  51. <li class="toctree-l1"><a class="reference internal" href="grpc_reflection.html">gRPC Reflection</a></li>
  52. <li class="toctree-l1"><a class="reference internal" href="grpc_status.html">gRPC Status</a></li>
  53. <li class="toctree-l1"><a class="reference internal" href="grpc_testing.html">gRPC Testing</a></li>
  54. <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
  55. </ul>
  56. <div class="relations">
  57. <h3>Related Topics</h3>
  58. <ul>
  59. <li><a href="index.html">Documentation overview</a><ul>
  60. <li>Previous: <a href="grpc.html" title="previous chapter">gRPC</a></li>
  61. <li>Next: <a href="grpc_channelz.html" title="next chapter">gRPC Channelz</a></li>
  62. </ul></li>
  63. </ul>
  64. </div>
  65. <div id="searchbox" style="display: none" role="search">
  66. <h3 id="searchlabel">Quick search</h3>
  67. <div class="searchformwrapper">
  68. <form class="search" action="search.html" method="get">
  69. <input type="text" name="q" aria-labelledby="searchlabel" />
  70. <input type="submit" value="Go" />
  71. </form>
  72. </div>
  73. </div>
  74. <script>$('#searchbox').show(0);</script>
  75. </div>
  76. </div>
  77. <div class="documentwrapper">
  78. <div class="bodywrapper">
  79. <div class="body" role="main">
  80. <div class="section" id="module-grpc.aio">
  81. <span id="grpc-asyncio-api"></span><h1>gRPC AsyncIO API<a class="headerlink" href="#module-grpc.aio" title="Permalink to this headline">¶</a></h1>
  82. <div class="section" id="overview">
  83. <h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
  84. <p>gRPC AsyncIO API is the <strong>new version</strong> of gRPC Python whose architecture is
  85. tailored to AsyncIO. Underlying, it utilizes the same C-extension, gRPC C-Core,
  86. as existing stack, and it replaces all gRPC IO operations with methods provided
  87. by the AsyncIO library.</p>
  88. <p>This API is stable. Feel free to open issues on our GitHub repo
  89. <a class="reference external" href="https://github.com/grpc/grpc">grpc/grpc</a> for bugs or suggestions.</p>
  90. <p>The design doc can be found here as <a class="reference external" href="https://github.com/grpc/proposal/pull/155">gRFC</a>.</p>
  91. </div>
  92. <div class="section" id="caveats">
  93. <h2>Caveats<a class="headerlink" href="#caveats" title="Permalink to this headline">¶</a></h2>
  94. <p>gRPC Async API objects may only be used on the thread on which they were
  95. created. AsyncIO doesn’t provide thread safety for most of its APIs.</p>
  96. </div>
  97. <div class="section" id="blocking-code-in-asyncio">
  98. <h2>Blocking Code in AsyncIO<a class="headerlink" href="#blocking-code-in-asyncio" title="Permalink to this headline">¶</a></h2>
  99. <p>Making blocking function calls in coroutines or in the thread running event
  100. loop will block the event loop, potentially starving all RPCs in the process.
  101. Refer to the Python language documentation on AsyncIO for more details (<a class="reference external" href="https://docs.python.org/3/library/asyncio-dev.html#running-blocking-code">running-blocking-code</a>).</p>
  102. </div>
  103. <div class="section" id="module-contents">
  104. <h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2>
  105. <div class="section" id="create-channel">
  106. <h3>Create Channel<a class="headerlink" href="#create-channel" title="Permalink to this headline">¶</a></h3>
  107. <p>Channels are the abstraction of clients, where most of networking logic
  108. happens, for example, managing one or more underlying connections, name
  109. resolution, load balancing, flow control, etc.. If you are using ProtoBuf,
  110. Channel objects works best when further encapsulate into stub objects, then the
  111. application can invoke remote functions as if they are local functions.</p>
  112. <dl class="py function">
  113. <dt id="grpc.aio.insecure_channel">
  114. <code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">insecure_channel</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interceptors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_channel.html#insecure_channel"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.insecure_channel" title="Permalink to this definition">¶</a></dt>
  115. <dd><p>Creates an insecure asynchronous Channel to a server.</p>
  116. <dl class="field-list simple">
  117. <dt class="field-odd">Parameters</dt>
  118. <dd class="field-odd"><ul class="simple">
  119. <li><p><strong>target</strong> (<em>str</em>) – The server address</p></li>
  120. <li><p><strong>options</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><em>Tuple</em><em>[</em><em>str</em><em>, </em><em>Any</em><em>]</em><em>]</em><em>]</em>) – 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>
  121. in gRPC Core runtime) to configure the channel.</p></li>
  122. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An optional value indicating the compression method to be
  123. used over the lifetime of the channel. This is an EXPERIMENTAL option.</p></li>
  124. <li><p><strong>interceptors</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><em>grpc.aio._interceptor.ClientInterceptor</em><em>]</em><em>]</em>) – An optional sequence of interceptors that will be executed for
  125. any call executed with this channel.</p></li>
  126. </ul>
  127. </dd>
  128. <dt class="field-even">Returns</dt>
  129. <dd class="field-even"><p>A Channel.</p>
  130. </dd>
  131. </dl>
  132. </dd></dl>
  133. <dl class="py function">
  134. <dt id="grpc.aio.secure_channel">
  135. <code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">secure_channel</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interceptors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_channel.html#secure_channel"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.secure_channel" title="Permalink to this definition">¶</a></dt>
  136. <dd><p>Creates a secure asynchronous Channel to a server.</p>
  137. <dl class="field-list simple">
  138. <dt class="field-odd">Parameters</dt>
  139. <dd class="field-odd"><ul class="simple">
  140. <li><p><strong>target</strong> (<em>str</em>) – The server address.</p></li>
  141. <li><p><strong>credentials</strong> (<a class="reference internal" href="grpc.html#grpc.ChannelCredentials" title="grpc.ChannelCredentials"><em>grpc.ChannelCredentials</em></a>) – A ChannelCredentials instance.</p></li>
  142. <li><p><strong>options</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><em>Tuple</em><em>[</em><em>str</em><em>, </em><em>Any</em><em>]</em><em>]</em><em>]</em>) – An optional list of key-value pairs (<a class="reference internal" href="glossary.html#term-channel_arguments"><span class="xref std std-term">channel_arguments</span></a>
  143. in gRPC Core runtime) to configure the channel.</p></li>
  144. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An optional value indicating the compression method to be
  145. used over the lifetime of the channel. This is an EXPERIMENTAL option.</p></li>
  146. <li><p><strong>interceptors</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><em>grpc.aio._interceptor.ClientInterceptor</em><em>]</em><em>]</em>) – An optional sequence of interceptors that will be executed for
  147. any call executed with this channel.</p></li>
  148. </ul>
  149. </dd>
  150. <dt class="field-even">Returns</dt>
  151. <dd class="field-even"><p>An aio.Channel.</p>
  152. </dd>
  153. </dl>
  154. </dd></dl>
  155. </div>
  156. <div class="section" id="channel-object">
  157. <h3>Channel Object<a class="headerlink" href="#channel-object" title="Permalink to this headline">¶</a></h3>
  158. <dl class="py class">
  159. <dt id="grpc.aio.Channel">
  160. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">Channel</span></code><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel" title="Permalink to this definition">¶</a></dt>
  161. <dd><p>Enables asynchronous RPC invocation as a client.</p>
  162. <p>Channel objects implement the Asynchronous Context Manager (aka. async
  163. with) type, although they are not supportted to be entered and exited
  164. multiple times.</p>
  165. <dl class="py method">
  166. <dt id="grpc.aio.Channel.__aenter__">
  167. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">__aenter__</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.__aenter__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.__aenter__" title="Permalink to this definition">¶</a></dt>
  168. <dd><p>Starts an asynchronous context manager.</p>
  169. <dl class="field-list simple">
  170. <dt class="field-odd">Returns</dt>
  171. <dd class="field-odd"><p>Channel the channel that was instantiated.</p>
  172. </dd>
  173. </dl>
  174. </dd></dl>
  175. <dl class="py method">
  176. <dt id="grpc.aio.Channel.__aexit__">
  177. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">__aexit__</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exc_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exc_val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exc_tb</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.__aexit__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.__aexit__" title="Permalink to this definition">¶</a></dt>
  178. <dd><p>Finishes the asynchronous context manager by closing the channel.</p>
  179. <p>Still active RPCs will be cancelled.</p>
  180. </dd></dl>
  181. <dl class="py method">
  182. <dt id="grpc.aio.Channel.channel_ready">
  183. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">channel_ready</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.channel_ready"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.channel_ready" title="Permalink to this definition">¶</a></dt>
  184. <dd><p>Creates a coroutine that blocks until the Channel is READY.</p>
  185. <dl class="field-list simple">
  186. <dt class="field-odd">Return type</dt>
  187. <dd class="field-odd"><p>None</p>
  188. </dd>
  189. </dl>
  190. </dd></dl>
  191. <dl class="py method">
  192. <dt id="grpc.aio.Channel.close">
  193. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">close</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">grace</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.close"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.close" title="Permalink to this definition">¶</a></dt>
  194. <dd><p>Closes this Channel and releases all resources held by it.</p>
  195. <p>This method immediately stops the channel from executing new RPCs in
  196. all cases.</p>
  197. <p>If a grace period is specified, this method wait until all active
  198. RPCs are finshed, once the grace period is reached the ones that haven’t
  199. been terminated are cancelled. If a grace period is not specified
  200. (by passing None for grace), all existing RPCs are cancelled immediately.</p>
  201. <p>This method is idempotent.</p>
  202. <dl class="field-list simple">
  203. <dt class="field-odd">Parameters</dt>
  204. <dd class="field-odd"><p><strong>grace</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – </p>
  205. </dd>
  206. </dl>
  207. </dd></dl>
  208. <dl class="py method">
  209. <dt id="grpc.aio.Channel.get_state">
  210. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">get_state</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">try_to_connect</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.get_state"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.get_state" title="Permalink to this definition">¶</a></dt>
  211. <dd><p>Checks the connectivity state of a channel.</p>
  212. <p>This is an EXPERIMENTAL API.</p>
  213. <p>If the channel reaches a stable connectivity state, it is guaranteed
  214. that the return value of this function will eventually converge to that
  215. state.</p>
  216. <dl class="field-list simple">
  217. <dt class="field-odd">Parameters</dt>
  218. <dd class="field-odd"><p><strong>try_to_connect</strong> (<em>bool</em>) – a bool indicate whether the Channel should try to
  219. connect to peer or not.</p>
  220. </dd>
  221. <dt class="field-even">Return type</dt>
  222. <dd class="field-even"><p><a class="reference internal" href="grpc.html#grpc.ChannelConnectivity" title="grpc.ChannelConnectivity">grpc.ChannelConnectivity</a></p>
  223. </dd>
  224. </dl>
  225. <p>Returns: A ChannelConnectivity object.</p>
  226. </dd></dl>
  227. <dl class="py method">
  228. <dt id="grpc.aio.Channel.stream_stream">
  229. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">stream_stream</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_serializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_deserializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.stream_stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.stream_stream" title="Permalink to this definition">¶</a></dt>
  230. <dd><p>Creates a StreamStreamMultiCallable for a stream-stream method.</p>
  231. <dl class="field-list simple">
  232. <dt class="field-odd">Parameters</dt>
  233. <dd class="field-odd"><ul class="simple">
  234. <li><p><strong>method</strong> (<em>str</em>) – The name of the RPC method.</p></li>
  235. <li><p><strong>request_serializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>bytes</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  236. message. Request goes unserialized in case None is passed.</p></li>
  237. <li><p><strong>response_deserializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>bytes</em><em>]</em><em>, </em><em>Any</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  238. response message. Response goes undeserialized in case None
  239. is passed.</p></li>
  240. </ul>
  241. </dd>
  242. <dt class="field-even">Returns</dt>
  243. <dd class="field-even"><p>A StreamStreamMultiCallable value for the named stream-stream method.</p>
  244. </dd>
  245. <dt class="field-odd">Return type</dt>
  246. <dd class="field-odd"><p>grpc.aio._base_channel.StreamStreamMultiCallable</p>
  247. </dd>
  248. </dl>
  249. </dd></dl>
  250. <dl class="py method">
  251. <dt id="grpc.aio.Channel.stream_unary">
  252. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">stream_unary</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_serializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_deserializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.stream_unary"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.stream_unary" title="Permalink to this definition">¶</a></dt>
  253. <dd><p>Creates a StreamUnaryMultiCallable for a stream-unary method.</p>
  254. <dl class="field-list simple">
  255. <dt class="field-odd">Parameters</dt>
  256. <dd class="field-odd"><ul class="simple">
  257. <li><p><strong>method</strong> (<em>str</em>) – The name of the RPC method.</p></li>
  258. <li><p><strong>request_serializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>bytes</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  259. message. Request goes unserialized in case None is passed.</p></li>
  260. <li><p><strong>response_deserializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>bytes</em><em>]</em><em>, </em><em>Any</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  261. response message. Response goes undeserialized in case None
  262. is passed.</p></li>
  263. </ul>
  264. </dd>
  265. <dt class="field-even">Returns</dt>
  266. <dd class="field-even"><p>A StreamUnaryMultiCallable value for the named stream-unary method.</p>
  267. </dd>
  268. <dt class="field-odd">Return type</dt>
  269. <dd class="field-odd"><p>grpc.aio._base_channel.StreamUnaryMultiCallable</p>
  270. </dd>
  271. </dl>
  272. </dd></dl>
  273. <dl class="py method">
  274. <dt id="grpc.aio.Channel.unary_stream">
  275. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">unary_stream</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_serializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_deserializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.unary_stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.unary_stream" title="Permalink to this definition">¶</a></dt>
  276. <dd><p>Creates a UnaryStreamMultiCallable for a unary-stream method.</p>
  277. <dl class="field-list simple">
  278. <dt class="field-odd">Parameters</dt>
  279. <dd class="field-odd"><ul class="simple">
  280. <li><p><strong>method</strong> (<em>str</em>) – The name of the RPC method.</p></li>
  281. <li><p><strong>request_serializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>bytes</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  282. message. Request goes unserialized in case None is passed.</p></li>
  283. <li><p><strong>response_deserializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>bytes</em><em>]</em><em>, </em><em>Any</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  284. response message. Response goes undeserialized in case None
  285. is passed.</p></li>
  286. </ul>
  287. </dd>
  288. <dt class="field-even">Returns</dt>
  289. <dd class="field-even"><p>A UnarySteramMultiCallable value for the named unary-stream method.</p>
  290. </dd>
  291. <dt class="field-odd">Return type</dt>
  292. <dd class="field-odd"><p>grpc.aio._base_channel.UnaryStreamMultiCallable</p>
  293. </dd>
  294. </dl>
  295. </dd></dl>
  296. <dl class="py method">
  297. <dt id="grpc.aio.Channel.unary_unary">
  298. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">unary_unary</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_serializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_deserializer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.unary_unary"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.unary_unary" title="Permalink to this definition">¶</a></dt>
  299. <dd><p>Creates a UnaryUnaryMultiCallable for a unary-unary method.</p>
  300. <dl class="field-list simple">
  301. <dt class="field-odd">Parameters</dt>
  302. <dd class="field-odd"><ul class="simple">
  303. <li><p><strong>method</strong> (<em>str</em>) – The name of the RPC method.</p></li>
  304. <li><p><strong>request_serializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>bytes</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-serializer"><span class="xref std std-term">serializer</span></a> for serializing the request
  305. message. Request goes unserialized in case None is passed.</p></li>
  306. <li><p><strong>response_deserializer</strong> (<em>Optional</em><em>[</em><em>Callable</em><em>[</em><em>[</em><em>bytes</em><em>]</em><em>, </em><em>Any</em><em>]</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-deserializer"><span class="xref std std-term">deserializer</span></a> for deserializing the
  307. response message. Response goes undeserialized in case None
  308. is passed.</p></li>
  309. </ul>
  310. </dd>
  311. <dt class="field-even">Returns</dt>
  312. <dd class="field-even"><p>A UnaryUnaryMultiCallable value for the named unary-unary method.</p>
  313. </dd>
  314. <dt class="field-odd">Return type</dt>
  315. <dd class="field-odd"><p>grpc.aio._base_channel.UnaryUnaryMultiCallable</p>
  316. </dd>
  317. </dl>
  318. </dd></dl>
  319. <dl class="py method">
  320. <dt id="grpc.aio.Channel.wait_for_state_change">
  321. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">wait_for_state_change</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">last_observed_state</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#Channel.wait_for_state_change"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Channel.wait_for_state_change" title="Permalink to this definition">¶</a></dt>
  322. <dd><p>Waits for a change in connectivity state.</p>
  323. <p>This is an EXPERIMENTAL API.</p>
  324. <p>The function blocks until there is a change in the channel connectivity
  325. state from the “last_observed_state”. If the state is already
  326. different, this function will return immediately.</p>
  327. <p>There is an inherent race between the invocation of
  328. “Channel.wait_for_state_change” and “Channel.get_state”. The state can
  329. change arbitrary many times during the race, so there is no way to
  330. observe every state transition.</p>
  331. <p>If there is a need to put a timeout for this function, please refer to
  332. “asyncio.wait_for”.</p>
  333. <dl class="field-list simple">
  334. <dt class="field-odd">Parameters</dt>
  335. <dd class="field-odd"><p><strong>last_observed_state</strong> (<a class="reference internal" href="grpc.html#grpc.ChannelConnectivity" title="grpc.ChannelConnectivity"><em>grpc.ChannelConnectivity</em></a>) – A grpc.ChannelConnectivity object representing
  336. the last known state.</p>
  337. </dd>
  338. <dt class="field-even">Return type</dt>
  339. <dd class="field-even"><p>None</p>
  340. </dd>
  341. </dl>
  342. </dd></dl>
  343. </dd></dl>
  344. </div>
  345. <div class="section" id="create-server">
  346. <h3>Create Server<a class="headerlink" href="#create-server" title="Permalink to this headline">¶</a></h3>
  347. <dl class="py function">
  348. <dt id="grpc.aio.server">
  349. <code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">server</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">migration_thread_pool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">handlers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interceptors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maximum_concurrent_rpcs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_server.html#server"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.server" title="Permalink to this definition">¶</a></dt>
  350. <dd><p>Creates a Server with which RPCs can be serviced.</p>
  351. <dl class="field-list simple">
  352. <dt class="field-odd">Parameters</dt>
  353. <dd class="field-odd"><ul class="simple">
  354. <li><p><strong>migration_thread_pool</strong> (<em>Optional</em><em>[</em><em>concurrent.futures._base.Executor</em><em>]</em>) – A futures.ThreadPoolExecutor to be used by the
  355. Server to execute non-AsyncIO RPC handlers for migration purpose.</p></li>
  356. <li><p><strong>handlers</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><a class="reference internal" href="grpc.html#grpc.GenericRpcHandler" title="grpc.GenericRpcHandler"><em>grpc.GenericRpcHandler</em></a><em>]</em><em>]</em>) – An optional list of GenericRpcHandlers used for executing RPCs.
  357. More handlers may be added by calling add_generic_rpc_handlers any time
  358. before the server is started.</p></li>
  359. <li><p><strong>interceptors</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><em>Any</em><em>]</em><em>]</em>) – An optional list of ServerInterceptor objects that observe
  360. and optionally manipulate the incoming RPCs before handing them over to
  361. handlers. The interceptors are given control in the order they are
  362. specified. This is an EXPERIMENTAL API.</p></li>
  363. <li><p><strong>options</strong> (<em>Optional</em><em>[</em><em>Sequence</em><em>[</em><em>Tuple</em><em>[</em><em>str</em><em>, </em><em>Any</em><em>]</em><em>]</em><em>]</em>) – 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)
  364. to configure the channel.</p></li>
  365. <li><p><strong>maximum_concurrent_rpcs</strong> (<em>Optional</em><em>[</em><em>int</em><em>]</em>) – The maximum number of concurrent RPCs this server
  366. will service before returning RESOURCE_EXHAUSTED status, or None to
  367. indicate no limit.</p></li>
  368. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An element of grpc.compression, e.g.
  369. grpc.compression.Gzip. This compression algorithm will be used for the
  370. lifetime of the server unless overridden by set_compression. This is an
  371. EXPERIMENTAL option.</p></li>
  372. </ul>
  373. </dd>
  374. <dt class="field-even">Returns</dt>
  375. <dd class="field-even"><p>A Server object.</p>
  376. </dd>
  377. </dl>
  378. </dd></dl>
  379. </div>
  380. <div class="section" id="server-object">
  381. <h3>Server Object<a class="headerlink" href="#server-object" title="Permalink to this headline">¶</a></h3>
  382. <dl class="py class">
  383. <dt id="grpc.aio.Server">
  384. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">Server</span></code><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server" title="Permalink to this definition">¶</a></dt>
  385. <dd><p>Serves RPCs.</p>
  386. <dl class="py method">
  387. <dt id="grpc.aio.Server.add_generic_rpc_handlers">
  388. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_generic_rpc_handlers</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">generic_rpc_handlers</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server.add_generic_rpc_handlers"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server.add_generic_rpc_handlers" title="Permalink to this definition">¶</a></dt>
  389. <dd><p>Registers GenericRpcHandlers with this Server.</p>
  390. <p>This method is only safe to call before the server is started.</p>
  391. <dl class="field-list simple">
  392. <dt class="field-odd">Parameters</dt>
  393. <dd class="field-odd"><ul class="simple">
  394. <li><p><strong>generic_rpc_handlers</strong> (<em>Sequence</em><em>[</em><a class="reference internal" href="grpc.html#grpc.GenericRpcHandler" title="grpc.GenericRpcHandler"><em>grpc.GenericRpcHandler</em></a><em>]</em>) – A sequence of GenericRpcHandlers that will be</p></li>
  395. <li><p><strong>to service RPCs.</strong> (<em>used</em>) – </p></li>
  396. </ul>
  397. </dd>
  398. <dt class="field-even">Return type</dt>
  399. <dd class="field-even"><p>None</p>
  400. </dd>
  401. </dl>
  402. </dd></dl>
  403. <dl class="py method">
  404. <dt id="grpc.aio.Server.add_insecure_port">
  405. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_insecure_port</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">address</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server.add_insecure_port"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server.add_insecure_port" title="Permalink to this definition">¶</a></dt>
  406. <dd><p>Opens an insecure port for accepting RPCs.</p>
  407. <p>A port is a communication endpoint that used by networking protocols,
  408. like TCP and UDP. To date, we only support TCP.</p>
  409. <p>This method may only be called before starting the server.</p>
  410. <dl class="field-list simple">
  411. <dt class="field-odd">Parameters</dt>
  412. <dd class="field-odd"><p><strong>address</strong> (<em>str</em>) – The address for which to open a port. If the port is 0,
  413. or not specified in the address, then the gRPC runtime will choose a port.</p>
  414. </dd>
  415. <dt class="field-even">Returns</dt>
  416. <dd class="field-even"><p>An integer port on which the server will accept RPC requests.</p>
  417. </dd>
  418. <dt class="field-odd">Return type</dt>
  419. <dd class="field-odd"><p>int</p>
  420. </dd>
  421. </dl>
  422. </dd></dl>
  423. <dl class="py method">
  424. <dt id="grpc.aio.Server.add_secure_port">
  425. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_secure_port</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">address</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">server_credentials</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server.add_secure_port"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server.add_secure_port" title="Permalink to this definition">¶</a></dt>
  426. <dd><p>Opens a secure port for accepting RPCs.</p>
  427. <p>A port is a communication endpoint that used by networking protocols,
  428. like TCP and UDP. To date, we only support TCP.</p>
  429. <p>This method may only be called before starting the server.</p>
  430. <dl class="field-list simple">
  431. <dt class="field-odd">Parameters</dt>
  432. <dd class="field-odd"><ul class="simple">
  433. <li><p><strong>address</strong> (<em>str</em>) – The address for which to open a port.
  434. if the port is 0, or not specified in the address, then the gRPC
  435. runtime will choose a port.</p></li>
  436. <li><p><strong>server_credentials</strong> (<a class="reference internal" href="grpc.html#grpc.ServerCredentials" title="grpc.ServerCredentials"><em>grpc.ServerCredentials</em></a>) – A ServerCredentials object.</p></li>
  437. </ul>
  438. </dd>
  439. <dt class="field-even">Returns</dt>
  440. <dd class="field-even"><p>An integer port on which the server will accept RPC requests.</p>
  441. </dd>
  442. <dt class="field-odd">Return type</dt>
  443. <dd class="field-odd"><p>int</p>
  444. </dd>
  445. </dl>
  446. </dd></dl>
  447. <dl class="py method">
  448. <dt id="grpc.aio.Server.start">
  449. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">start</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server.start"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server.start" title="Permalink to this definition">¶</a></dt>
  450. <dd><p>Starts this Server.</p>
  451. <p>This method may only be called once. (i.e. it is not idempotent).</p>
  452. <dl class="field-list simple">
  453. <dt class="field-odd">Return type</dt>
  454. <dd class="field-odd"><p>None</p>
  455. </dd>
  456. </dl>
  457. </dd></dl>
  458. <dl class="py method">
  459. <dt id="grpc.aio.Server.stop">
  460. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">stop</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">grace</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server.stop"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server.stop" title="Permalink to this definition">¶</a></dt>
  461. <dd><p>Stops this Server.</p>
  462. <p>This method immediately stops the server from servicing new RPCs in
  463. all cases.</p>
  464. <p>If a grace period is specified, this method returns immediately and all
  465. RPCs active at the end of the grace period are aborted. If a grace
  466. period is not specified (by passing None for grace), all existing RPCs
  467. are aborted immediately and this method blocks until the last RPC
  468. handler terminates.</p>
  469. <p>This method is idempotent and may be called at any time. Passing a
  470. smaller grace value in a subsequent call will have the effect of
  471. stopping the Server sooner (passing None will have the effect of
  472. stopping the server immediately). Passing a larger grace value in a
  473. subsequent call will not have the effect of stopping the server later
  474. (i.e. the most restrictive grace value is used).</p>
  475. <dl class="field-list simple">
  476. <dt class="field-odd">Parameters</dt>
  477. <dd class="field-odd"><p><strong>grace</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – A duration of time in seconds or None.</p>
  478. </dd>
  479. <dt class="field-even">Return type</dt>
  480. <dd class="field-even"><p>None</p>
  481. </dd>
  482. </dl>
  483. </dd></dl>
  484. <dl class="py method">
  485. <dt id="grpc.aio.Server.wait_for_termination">
  486. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">wait_for_termination</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#Server.wait_for_termination"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Server.wait_for_termination" title="Permalink to this definition">¶</a></dt>
  487. <dd><p>Continues current coroutine once the server stops.</p>
  488. <p>This is an EXPERIMENTAL API.</p>
  489. <p>The wait will not consume computational resources during blocking, and
  490. it will block until one of the two following conditions are met:</p>
  491. <ol class="arabic simple">
  492. <li><p>The server is stopped or terminated;</p></li>
  493. <li><p>A timeout occurs if timeout is not <cite>None</cite>.</p></li>
  494. </ol>
  495. <p>The timeout argument works in the same way as <cite>threading.Event.wait()</cite>.
  496. <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>
  497. <dl class="field-list simple">
  498. <dt class="field-odd">Parameters</dt>
  499. <dd class="field-odd"><p><strong>timeout</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – A floating point number specifying a timeout for the
  500. operation in seconds.</p>
  501. </dd>
  502. <dt class="field-even">Returns</dt>
  503. <dd class="field-even"><p>A bool indicates if the operation times out.</p>
  504. </dd>
  505. <dt class="field-odd">Return type</dt>
  506. <dd class="field-odd"><p>bool</p>
  507. </dd>
  508. </dl>
  509. </dd></dl>
  510. </dd></dl>
  511. </div>
  512. <div class="section" id="grpc-exceptions">
  513. <h3>gRPC Exceptions<a class="headerlink" href="#grpc-exceptions" title="Permalink to this headline">¶</a></h3>
  514. <dl class="py exception">
  515. <dt id="grpc.aio.BaseError">
  516. <em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">BaseError</span></code><a class="headerlink" href="#grpc.aio.BaseError" title="Permalink to this definition">¶</a></dt>
  517. <dd><p>The base class for exceptions generated by gRPC AsyncIO stack.</p>
  518. </dd></dl>
  519. <dl class="py exception">
  520. <dt id="grpc.aio.UsageError">
  521. <em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UsageError</span></code><a class="headerlink" href="#grpc.aio.UsageError" title="Permalink to this definition">¶</a></dt>
  522. <dd><p>Raised when the usage of API by applications is inappropriate.</p>
  523. <p>For example, trying to invoke RPC on a closed channel, mixing two styles
  524. of streaming API on the client side. This exception should not be
  525. suppressed.</p>
  526. </dd></dl>
  527. <dl class="py exception">
  528. <dt id="grpc.aio.AbortError">
  529. <em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">AbortError</span></code><a class="headerlink" href="#grpc.aio.AbortError" title="Permalink to this definition">¶</a></dt>
  530. <dd><p>Raised when calling abort in servicer methods.</p>
  531. <p>This exception should not be suppressed. Applications may catch it to
  532. perform certain clean-up logic, and then re-raise it.</p>
  533. </dd></dl>
  534. <dl class="py exception">
  535. <dt id="grpc.aio.InternalError">
  536. <em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">InternalError</span></code><a class="headerlink" href="#grpc.aio.InternalError" title="Permalink to this definition">¶</a></dt>
  537. <dd><p>Raised upon unexpected errors in native code.</p>
  538. </dd></dl>
  539. <dl class="py exception">
  540. <dt id="grpc.aio.AioRpcError">
  541. <em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">AioRpcError</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initial_metadata</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trailing_metadata</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">details</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">debug_error_string</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_call.html#AioRpcError"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.AioRpcError" title="Permalink to this definition">¶</a></dt>
  542. <dd><p>An implementation of RpcError to be used by the asynchronous API.</p>
  543. <p>Raised RpcError is a snapshot of the final status of the RPC, values are
  544. determined. Hence, its methods no longer needs to be coroutines.</p>
  545. <dl class="field-list simple">
  546. <dt class="field-odd">Parameters</dt>
  547. <dd class="field-odd"><ul class="simple">
  548. <li><p><strong>code</strong> (<a class="reference internal" href="grpc.html#grpc.StatusCode" title="grpc.StatusCode"><em>grpc.StatusCode</em></a>) – </p></li>
  549. <li><p><strong>initial_metadata</strong> (<em>grpc.aio._metadata.Metadata</em>) – </p></li>
  550. <li><p><strong>trailing_metadata</strong> (<em>grpc.aio._metadata.Metadata</em>) – </p></li>
  551. <li><p><strong>details</strong> (<em>Optional</em><em>[</em><em>str</em><em>]</em>) – </p></li>
  552. <li><p><strong>debug_error_string</strong> (<em>Optional</em><em>[</em><em>str</em><em>]</em>) – </p></li>
  553. </ul>
  554. </dd>
  555. <dt class="field-even">Return type</dt>
  556. <dd class="field-even"><p>None</p>
  557. </dd>
  558. </dl>
  559. <dl class="py method">
  560. <dt id="grpc.aio.AioRpcError.code">
  561. <code class="sig-name descname"><span class="pre">code</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_call.html#AioRpcError.code"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.AioRpcError.code" title="Permalink to this definition">¶</a></dt>
  562. <dd><p>Accesses the status code sent by the server.</p>
  563. <dl class="field-list simple">
  564. <dt class="field-odd">Returns</dt>
  565. <dd class="field-odd"><p>The <cite>grpc.StatusCode</cite> status code.</p>
  566. </dd>
  567. <dt class="field-even">Return type</dt>
  568. <dd class="field-even"><p><a class="reference internal" href="grpc.html#grpc.StatusCode" title="grpc.StatusCode">grpc.StatusCode</a></p>
  569. </dd>
  570. </dl>
  571. </dd></dl>
  572. <dl class="py method">
  573. <dt id="grpc.aio.AioRpcError.debug_error_string">
  574. <code class="sig-name descname"><span class="pre">debug_error_string</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_call.html#AioRpcError.debug_error_string"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.AioRpcError.debug_error_string" title="Permalink to this definition">¶</a></dt>
  575. <dd><p>Accesses the debug error string sent by the server.</p>
  576. <dl class="field-list simple">
  577. <dt class="field-odd">Returns</dt>
  578. <dd class="field-odd"><p>The debug error string received.</p>
  579. </dd>
  580. <dt class="field-even">Return type</dt>
  581. <dd class="field-even"><p>str</p>
  582. </dd>
  583. </dl>
  584. </dd></dl>
  585. <dl class="py method">
  586. <dt id="grpc.aio.AioRpcError.details">
  587. <code class="sig-name descname"><span class="pre">details</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_call.html#AioRpcError.details"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.AioRpcError.details" title="Permalink to this definition">¶</a></dt>
  588. <dd><p>Accesses the details sent by the server.</p>
  589. <dl class="field-list simple">
  590. <dt class="field-odd">Returns</dt>
  591. <dd class="field-odd"><p>The description of the error.</p>
  592. </dd>
  593. <dt class="field-even">Return type</dt>
  594. <dd class="field-even"><p>Optional[str]</p>
  595. </dd>
  596. </dl>
  597. </dd></dl>
  598. <dl class="py method">
  599. <dt id="grpc.aio.AioRpcError.initial_metadata">
  600. <code class="sig-name descname"><span class="pre">initial_metadata</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_call.html#AioRpcError.initial_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.AioRpcError.initial_metadata" title="Permalink to this definition">¶</a></dt>
  601. <dd><p>Accesses the initial metadata sent by the server.</p>
  602. <dl class="field-list simple">
  603. <dt class="field-odd">Returns</dt>
  604. <dd class="field-odd"><p>The initial metadata received.</p>
  605. </dd>
  606. <dt class="field-even">Return type</dt>
  607. <dd class="field-even"><p>grpc.aio._metadata.Metadata</p>
  608. </dd>
  609. </dl>
  610. </dd></dl>
  611. <dl class="py method">
  612. <dt id="grpc.aio.AioRpcError.trailing_metadata">
  613. <code class="sig-name descname"><span class="pre">trailing_metadata</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_call.html#AioRpcError.trailing_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.AioRpcError.trailing_metadata" title="Permalink to this definition">¶</a></dt>
  614. <dd><p>Accesses the trailing metadata sent by the server.</p>
  615. <dl class="field-list simple">
  616. <dt class="field-odd">Returns</dt>
  617. <dd class="field-odd"><p>The trailing metadata received.</p>
  618. </dd>
  619. <dt class="field-even">Return type</dt>
  620. <dd class="field-even"><p>grpc.aio._metadata.Metadata</p>
  621. </dd>
  622. </dl>
  623. </dd></dl>
  624. </dd></dl>
  625. </div>
  626. <div class="section" id="shared-context">
  627. <h3>Shared Context<a class="headerlink" href="#shared-context" title="Permalink to this headline">¶</a></h3>
  628. <dl class="py class">
  629. <dt id="grpc.aio.RpcContext">
  630. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">RpcContext</span></code><a class="reference internal" href="_modules/grpc/aio/_base_call.html#RpcContext"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.RpcContext" title="Permalink to this definition">¶</a></dt>
  631. <dd><p>Provides RPC-related information and action.</p>
  632. <dl class="py method">
  633. <dt id="grpc.aio.RpcContext.add_done_callback">
  634. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">add_done_callback</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#RpcContext.add_done_callback"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.RpcContext.add_done_callback" title="Permalink to this definition">¶</a></dt>
  635. <dd><p>Registers a callback to be called on RPC termination.</p>
  636. <dl class="field-list simple">
  637. <dt class="field-odd">Parameters</dt>
  638. <dd class="field-odd"><ul class="simple">
  639. <li><p><strong>callback</strong> (<em>Callable</em><em>[</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>None</em><em>]</em>) – A callable object will be called with the call object as</p></li>
  640. <li><p><strong>only argument.</strong> (<em>its</em>) – </p></li>
  641. </ul>
  642. </dd>
  643. <dt class="field-even">Return type</dt>
  644. <dd class="field-even"><p>None</p>
  645. </dd>
  646. </dl>
  647. </dd></dl>
  648. <dl class="py method">
  649. <dt id="grpc.aio.RpcContext.cancel">
  650. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">cancel</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#RpcContext.cancel"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.RpcContext.cancel" title="Permalink to this definition">¶</a></dt>
  651. <dd><p>Cancels the RPC.</p>
  652. <p>Idempotent and has no effect if the RPC has already terminated.</p>
  653. <dl class="field-list simple">
  654. <dt class="field-odd">Returns</dt>
  655. <dd class="field-odd"><p>A bool indicates if the cancellation is performed or not.</p>
  656. </dd>
  657. <dt class="field-even">Return type</dt>
  658. <dd class="field-even"><p>bool</p>
  659. </dd>
  660. </dl>
  661. </dd></dl>
  662. <dl class="py method">
  663. <dt id="grpc.aio.RpcContext.cancelled">
  664. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">cancelled</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#RpcContext.cancelled"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.RpcContext.cancelled" title="Permalink to this definition">¶</a></dt>
  665. <dd><p>Return True if the RPC is cancelled.</p>
  666. <p>The RPC is cancelled when the cancellation was requested with cancel().</p>
  667. <dl class="field-list simple">
  668. <dt class="field-odd">Returns</dt>
  669. <dd class="field-odd"><p>A bool indicates whether the RPC is cancelled or not.</p>
  670. </dd>
  671. <dt class="field-even">Return type</dt>
  672. <dd class="field-even"><p>bool</p>
  673. </dd>
  674. </dl>
  675. </dd></dl>
  676. <dl class="py method">
  677. <dt id="grpc.aio.RpcContext.done">
  678. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">done</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#RpcContext.done"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.RpcContext.done" title="Permalink to this definition">¶</a></dt>
  679. <dd><p>Return True if the RPC is done.</p>
  680. <p>An RPC is done if the RPC is completed, cancelled or aborted.</p>
  681. <dl class="field-list simple">
  682. <dt class="field-odd">Returns</dt>
  683. <dd class="field-odd"><p>A bool indicates if the RPC is done.</p>
  684. </dd>
  685. <dt class="field-even">Return type</dt>
  686. <dd class="field-even"><p>bool</p>
  687. </dd>
  688. </dl>
  689. </dd></dl>
  690. <dl class="py method">
  691. <dt id="grpc.aio.RpcContext.time_remaining">
  692. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">time_remaining</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#RpcContext.time_remaining"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.RpcContext.time_remaining" title="Permalink to this definition">¶</a></dt>
  693. <dd><p>Describes the length of allowed time remaining for the RPC.</p>
  694. <dl class="field-list simple">
  695. <dt class="field-odd">Returns</dt>
  696. <dd class="field-odd"><p>A nonnegative float indicating the length of allowed time in seconds
  697. remaining for the RPC to complete before it is considered to have
  698. timed out, or None if no deadline was specified for the RPC.</p>
  699. </dd>
  700. <dt class="field-even">Return type</dt>
  701. <dd class="field-even"><p>Optional[float]</p>
  702. </dd>
  703. </dl>
  704. </dd></dl>
  705. </dd></dl>
  706. </div>
  707. <div class="section" id="client-side-context">
  708. <h3>Client-Side Context<a class="headerlink" href="#client-side-context" title="Permalink to this headline">¶</a></h3>
  709. <dl class="py class">
  710. <dt id="grpc.aio.Call">
  711. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">Call</span></code><a class="reference internal" href="_modules/grpc/aio/_base_call.html#Call"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Call" title="Permalink to this definition">¶</a></dt>
  712. <dd><p>The abstract base class of an RPC on the client-side.</p>
  713. <dl class="py method">
  714. <dt id="grpc.aio.Call.code">
  715. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">code</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#Call.code"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Call.code" title="Permalink to this definition">¶</a></dt>
  716. <dd><p>Accesses the status code sent by the server.</p>
  717. <dl class="field-list simple">
  718. <dt class="field-odd">Returns</dt>
  719. <dd class="field-odd"><p>The StatusCode value for the RPC.</p>
  720. </dd>
  721. <dt class="field-even">Return type</dt>
  722. <dd class="field-even"><p><a class="reference internal" href="grpc.html#grpc.StatusCode" title="grpc.StatusCode">grpc.StatusCode</a></p>
  723. </dd>
  724. </dl>
  725. </dd></dl>
  726. <dl class="py method">
  727. <dt id="grpc.aio.Call.details">
  728. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">details</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#Call.details"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Call.details" title="Permalink to this definition">¶</a></dt>
  729. <dd><p>Accesses the details sent by the server.</p>
  730. <dl class="field-list simple">
  731. <dt class="field-odd">Returns</dt>
  732. <dd class="field-odd"><p>The details string of the RPC.</p>
  733. </dd>
  734. <dt class="field-even">Return type</dt>
  735. <dd class="field-even"><p>str</p>
  736. </dd>
  737. </dl>
  738. </dd></dl>
  739. <dl class="py method">
  740. <dt id="grpc.aio.Call.initial_metadata">
  741. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">initial_metadata</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#Call.initial_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Call.initial_metadata" title="Permalink to this definition">¶</a></dt>
  742. <dd><p>Accesses the initial metadata sent by the server.</p>
  743. <dl class="field-list simple">
  744. <dt class="field-odd">Returns</dt>
  745. <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>
  746. </dd>
  747. <dt class="field-even">Return type</dt>
  748. <dd class="field-even"><p>grpc.aio._metadata.Metadata</p>
  749. </dd>
  750. </dl>
  751. </dd></dl>
  752. <dl class="py method">
  753. <dt id="grpc.aio.Call.trailing_metadata">
  754. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">trailing_metadata</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#Call.trailing_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Call.trailing_metadata" title="Permalink to this definition">¶</a></dt>
  755. <dd><p>Accesses the trailing metadata sent by the server.</p>
  756. <dl class="field-list simple">
  757. <dt class="field-odd">Returns</dt>
  758. <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>
  759. </dd>
  760. <dt class="field-even">Return type</dt>
  761. <dd class="field-even"><p>grpc.aio._metadata.Metadata</p>
  762. </dd>
  763. </dl>
  764. </dd></dl>
  765. <dl class="py method">
  766. <dt id="grpc.aio.Call.wait_for_connection">
  767. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">wait_for_connection</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#Call.wait_for_connection"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.Call.wait_for_connection" title="Permalink to this definition">¶</a></dt>
  768. <dd><p>Waits until connected to peer and raises aio.AioRpcError if failed.</p>
  769. <p>This is an EXPERIMENTAL method.</p>
  770. <p>This method ensures the RPC has been successfully connected. Otherwise,
  771. an AioRpcError will be raised to explain the reason of the connection
  772. failure.</p>
  773. <p>This method is recommended for building retry mechanisms.</p>
  774. <dl class="field-list simple">
  775. <dt class="field-odd">Return type</dt>
  776. <dd class="field-odd"><p>None</p>
  777. </dd>
  778. </dl>
  779. </dd></dl>
  780. </dd></dl>
  781. <dl class="py class">
  782. <dt id="grpc.aio.UnaryUnaryCall">
  783. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UnaryUnaryCall</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#UnaryUnaryCall"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryUnaryCall" title="Permalink to this definition">¶</a></dt>
  784. <dd><p>The abstract base class of an unary-unary RPC on the client-side.</p>
  785. <dl class="py method">
  786. <dt id="grpc.aio.UnaryUnaryCall.__await__">
  787. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__await__</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#UnaryUnaryCall.__await__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryUnaryCall.__await__" title="Permalink to this definition">¶</a></dt>
  788. <dd><p>Await the response message to be ready.</p>
  789. <dl class="field-list simple">
  790. <dt class="field-odd">Returns</dt>
  791. <dd class="field-odd"><p>The response message of the RPC.</p>
  792. </dd>
  793. <dt class="field-even">Return type</dt>
  794. <dd class="field-even"><p>Awaitable[ResponseType]</p>
  795. </dd>
  796. </dl>
  797. </dd></dl>
  798. </dd></dl>
  799. <dl class="py class">
  800. <dt id="grpc.aio.UnaryStreamCall">
  801. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UnaryStreamCall</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#UnaryStreamCall"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamCall" title="Permalink to this definition">¶</a></dt>
  802. <dd><dl class="py method">
  803. <dt id="grpc.aio.UnaryStreamCall.__aiter__">
  804. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__aiter__</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#UnaryStreamCall.__aiter__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamCall.__aiter__" title="Permalink to this definition">¶</a></dt>
  805. <dd><p>Returns the async iterable representation that yields messages.</p>
  806. <p>Under the hood, it is calling the “read” method.</p>
  807. <dl class="field-list simple">
  808. <dt class="field-odd">Returns</dt>
  809. <dd class="field-odd"><p>An async iterable object that yields messages.</p>
  810. </dd>
  811. <dt class="field-even">Return type</dt>
  812. <dd class="field-even"><p>AsyncIterable[ResponseType]</p>
  813. </dd>
  814. </dl>
  815. </dd></dl>
  816. <dl class="py method">
  817. <dt id="grpc.aio.UnaryStreamCall.read">
  818. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">read</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#UnaryStreamCall.read"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamCall.read" title="Permalink to this definition">¶</a></dt>
  819. <dd><p>Reads one message from the stream.</p>
  820. <p>Read operations must be serialized when called from multiple
  821. coroutines.</p>
  822. <dl class="field-list simple">
  823. <dt class="field-odd">Returns</dt>
  824. <dd class="field-odd"><p>A response message, or an <cite>grpc.aio.EOF</cite> to indicate the end of the
  825. stream.</p>
  826. </dd>
  827. <dt class="field-even">Return type</dt>
  828. <dd class="field-even"><p>Union[grpc._cython.cygrpc._EOF, ResponseType]</p>
  829. </dd>
  830. </dl>
  831. </dd></dl>
  832. </dd></dl>
  833. <dl class="py class">
  834. <dt id="grpc.aio.StreamUnaryCall">
  835. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">StreamUnaryCall</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamUnaryCall"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryCall" title="Permalink to this definition">¶</a></dt>
  836. <dd><dl class="py method">
  837. <dt id="grpc.aio.StreamUnaryCall.__await__">
  838. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__await__</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamUnaryCall.__await__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryCall.__await__" title="Permalink to this definition">¶</a></dt>
  839. <dd><p>Await the response message to be ready.</p>
  840. <dl class="field-list simple">
  841. <dt class="field-odd">Returns</dt>
  842. <dd class="field-odd"><p>The response message of the stream.</p>
  843. </dd>
  844. <dt class="field-even">Return type</dt>
  845. <dd class="field-even"><p>Awaitable[ResponseType]</p>
  846. </dd>
  847. </dl>
  848. </dd></dl>
  849. <dl class="py method">
  850. <dt id="grpc.aio.StreamUnaryCall.done_writing">
  851. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">done_writing</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamUnaryCall.done_writing"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryCall.done_writing" title="Permalink to this definition">¶</a></dt>
  852. <dd><p>Notifies server that the client is done sending messages.</p>
  853. <p>After done_writing is called, any additional invocation to the write
  854. function will fail. This function is idempotent.</p>
  855. <dl class="field-list simple">
  856. <dt class="field-odd">Return type</dt>
  857. <dd class="field-odd"><p>None</p>
  858. </dd>
  859. </dl>
  860. </dd></dl>
  861. <dl class="py method">
  862. <dt id="grpc.aio.StreamUnaryCall.write">
  863. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">write</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamUnaryCall.write"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryCall.write" title="Permalink to this definition">¶</a></dt>
  864. <dd><p>Writes one message to the stream.</p>
  865. <dl class="field-list simple">
  866. <dt class="field-odd">Raises</dt>
  867. <dd class="field-odd"><p><strong>An RpcError exception if the write failed.</strong> – </p>
  868. </dd>
  869. <dt class="field-even">Parameters</dt>
  870. <dd class="field-even"><p><strong>request</strong> (<em>RequestType</em>) – </p>
  871. </dd>
  872. <dt class="field-odd">Return type</dt>
  873. <dd class="field-odd"><p>None</p>
  874. </dd>
  875. </dl>
  876. </dd></dl>
  877. </dd></dl>
  878. <dl class="py class">
  879. <dt id="grpc.aio.StreamStreamCall">
  880. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">StreamStreamCall</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamStreamCall"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamCall" title="Permalink to this definition">¶</a></dt>
  881. <dd><dl class="py method">
  882. <dt id="grpc.aio.StreamStreamCall.__aiter__">
  883. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__aiter__</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamStreamCall.__aiter__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamCall.__aiter__" title="Permalink to this definition">¶</a></dt>
  884. <dd><p>Returns the async iterable representation that yields messages.</p>
  885. <p>Under the hood, it is calling the “read” method.</p>
  886. <dl class="field-list simple">
  887. <dt class="field-odd">Returns</dt>
  888. <dd class="field-odd"><p>An async iterable object that yields messages.</p>
  889. </dd>
  890. <dt class="field-even">Return type</dt>
  891. <dd class="field-even"><p>AsyncIterable[ResponseType]</p>
  892. </dd>
  893. </dl>
  894. </dd></dl>
  895. <dl class="py method">
  896. <dt id="grpc.aio.StreamStreamCall.done_writing">
  897. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">done_writing</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamStreamCall.done_writing"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamCall.done_writing" title="Permalink to this definition">¶</a></dt>
  898. <dd><p>Notifies server that the client is done sending messages.</p>
  899. <p>After done_writing is called, any additional invocation to the write
  900. function will fail. This function is idempotent.</p>
  901. <dl class="field-list simple">
  902. <dt class="field-odd">Return type</dt>
  903. <dd class="field-odd"><p>None</p>
  904. </dd>
  905. </dl>
  906. </dd></dl>
  907. <dl class="py method">
  908. <dt id="grpc.aio.StreamStreamCall.read">
  909. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">read</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamStreamCall.read"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamCall.read" title="Permalink to this definition">¶</a></dt>
  910. <dd><p>Reads one message from the stream.</p>
  911. <p>Read operations must be serialized when called from multiple
  912. coroutines.</p>
  913. <dl class="field-list simple">
  914. <dt class="field-odd">Returns</dt>
  915. <dd class="field-odd"><p>A response message, or an <cite>grpc.aio.EOF</cite> to indicate the end of the
  916. stream.</p>
  917. </dd>
  918. <dt class="field-even">Return type</dt>
  919. <dd class="field-even"><p>Union[grpc._cython.cygrpc._EOF, ResponseType]</p>
  920. </dd>
  921. </dl>
  922. </dd></dl>
  923. <dl class="py method">
  924. <dt id="grpc.aio.StreamStreamCall.write">
  925. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">write</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_call.html#StreamStreamCall.write"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamCall.write" title="Permalink to this definition">¶</a></dt>
  926. <dd><p>Writes one message to the stream.</p>
  927. <dl class="field-list simple">
  928. <dt class="field-odd">Raises</dt>
  929. <dd class="field-odd"><p><strong>An RpcError exception if the write failed.</strong> – </p>
  930. </dd>
  931. <dt class="field-even">Parameters</dt>
  932. <dd class="field-even"><p><strong>request</strong> (<em>RequestType</em>) – </p>
  933. </dd>
  934. <dt class="field-odd">Return type</dt>
  935. <dd class="field-odd"><p>None</p>
  936. </dd>
  937. </dl>
  938. </dd></dl>
  939. </dd></dl>
  940. </div>
  941. <div class="section" id="server-side-context">
  942. <h3>Server-Side Context<a class="headerlink" href="#server-side-context" title="Permalink to this headline">¶</a></h3>
  943. <dl class="py class">
  944. <dt id="grpc.aio.ServicerContext">
  945. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">ServicerContext</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext" title="Permalink to this definition">¶</a></dt>
  946. <dd><p>A context object passed to method implementations.</p>
  947. <dl class="py method">
  948. <dt id="grpc.aio.ServicerContext.abort">
  949. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">abort</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">details</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trailing_metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.abort"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.abort" title="Permalink to this definition">¶</a></dt>
  950. <dd><p>Raises an exception to terminate the RPC with a non-OK status.</p>
  951. <p>The code and details passed as arguments will supercede any existing
  952. ones.</p>
  953. <dl class="field-list simple">
  954. <dt class="field-odd">Parameters</dt>
  955. <dd class="field-odd"><ul class="simple">
  956. <li><p><strong>code</strong> (<a class="reference internal" href="grpc.html#grpc.StatusCode" title="grpc.StatusCode"><em>grpc.StatusCode</em></a>) – A StatusCode object to be sent to the client.
  957. It must not be StatusCode.OK.</p></li>
  958. <li><p><strong>details</strong> (<em>str</em>) – A UTF-8-encodable string to be sent to the client upon
  959. termination of the RPC.</p></li>
  960. <li><p><strong>trailing_metadata</strong> (<em>grpc.aio._metadata.Metadata</em>) – A sequence of tuple represents the trailing
  961. <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p></li>
  962. </ul>
  963. </dd>
  964. <dt class="field-even">Raises</dt>
  965. <dd class="field-even"><p><strong>Exception</strong> – An exception is always raised to signal the abortion the
  966. RPC to the gRPC runtime.</p>
  967. </dd>
  968. <dt class="field-odd">Return type</dt>
  969. <dd class="field-odd"><p>None</p>
  970. </dd>
  971. </dl>
  972. </dd></dl>
  973. <dl class="py method">
  974. <dt id="grpc.aio.ServicerContext.auth_context">
  975. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">auth_context</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.auth_context"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.auth_context" title="Permalink to this definition">¶</a></dt>
  976. <dd><p>Gets the auth context for the call.</p>
  977. <dl class="field-list simple">
  978. <dt class="field-odd">Returns</dt>
  979. <dd class="field-odd"><p>A map of strings to an iterable of bytes for each auth property.</p>
  980. </dd>
  981. <dt class="field-even">Return type</dt>
  982. <dd class="field-even"><p>Mapping[str, Iterable[bytes]]</p>
  983. </dd>
  984. </dl>
  985. </dd></dl>
  986. <dl class="py method">
  987. <dt id="grpc.aio.ServicerContext.disable_next_message_compression">
  988. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">disable_next_message_compression</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.disable_next_message_compression"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.disable_next_message_compression" title="Permalink to this definition">¶</a></dt>
  989. <dd><p>Disables compression for the next response message.</p>
  990. <p>This is an EXPERIMENTAL method.</p>
  991. <p>This method will override any compression configuration set during
  992. server creation or set on the call.</p>
  993. <dl class="field-list simple">
  994. <dt class="field-odd">Return type</dt>
  995. <dd class="field-odd"><p>None</p>
  996. </dd>
  997. </dl>
  998. </dd></dl>
  999. <dl class="py method">
  1000. <dt id="grpc.aio.ServicerContext.invocation_metadata">
  1001. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">invocation_metadata</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.invocation_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.invocation_metadata" title="Permalink to this definition">¶</a></dt>
  1002. <dd><p>Accesses the metadata from the sent by the client.</p>
  1003. <dl class="field-list simple">
  1004. <dt class="field-odd">Returns</dt>
  1005. <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>
  1006. </dd>
  1007. <dt class="field-even">Return type</dt>
  1008. <dd class="field-even"><p>Optional[grpc.aio._metadata.Metadata]</p>
  1009. </dd>
  1010. </dl>
  1011. </dd></dl>
  1012. <dl class="py method">
  1013. <dt id="grpc.aio.ServicerContext.peer">
  1014. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">peer</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.peer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.peer" title="Permalink to this definition">¶</a></dt>
  1015. <dd><p>Identifies the peer that invoked the RPC being serviced.</p>
  1016. <dl class="field-list simple">
  1017. <dt class="field-odd">Returns</dt>
  1018. <dd class="field-odd"><p>A string identifying the peer that invoked the RPC being serviced.
  1019. The string format is determined by gRPC runtime.</p>
  1020. </dd>
  1021. <dt class="field-even">Return type</dt>
  1022. <dd class="field-even"><p>str</p>
  1023. </dd>
  1024. </dl>
  1025. </dd></dl>
  1026. <dl class="py method">
  1027. <dt id="grpc.aio.ServicerContext.peer_identities">
  1028. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">peer_identities</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.peer_identities"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.peer_identities" title="Permalink to this definition">¶</a></dt>
  1029. <dd><p>Gets one or more peer identity(s).</p>
  1030. <p>Equivalent to
  1031. servicer_context.auth_context().get(servicer_context.peer_identity_key())</p>
  1032. <dl class="field-list simple">
  1033. <dt class="field-odd">Returns</dt>
  1034. <dd class="field-odd"><p>An iterable of the identities, or None if the call is not
  1035. authenticated. Each identity is returned as a raw bytes type.</p>
  1036. </dd>
  1037. <dt class="field-even">Return type</dt>
  1038. <dd class="field-even"><p>Optional[Iterable[bytes]]</p>
  1039. </dd>
  1040. </dl>
  1041. </dd></dl>
  1042. <dl class="py method">
  1043. <dt id="grpc.aio.ServicerContext.peer_identity_key">
  1044. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">peer_identity_key</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.peer_identity_key"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.peer_identity_key" title="Permalink to this definition">¶</a></dt>
  1045. <dd><p>The auth property used to identify the peer.</p>
  1046. <p>For example, “x509_common_name” or “x509_subject_alternative_name” are
  1047. used to identify an SSL peer.</p>
  1048. <dl class="field-list simple">
  1049. <dt class="field-odd">Returns</dt>
  1050. <dd class="field-odd"><p>The auth property (string) that indicates the
  1051. peer identity, or None if the call is not authenticated.</p>
  1052. </dd>
  1053. <dt class="field-even">Return type</dt>
  1054. <dd class="field-even"><p>Optional[str]</p>
  1055. </dd>
  1056. </dl>
  1057. </dd></dl>
  1058. <dl class="py method">
  1059. <dt id="grpc.aio.ServicerContext.read">
  1060. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">read</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.read"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.read" title="Permalink to this definition">¶</a></dt>
  1061. <dd><p>Reads one message from the RPC.</p>
  1062. <p>Only one read operation is allowed simultaneously.</p>
  1063. <dl class="field-list simple">
  1064. <dt class="field-odd">Returns</dt>
  1065. <dd class="field-odd"><p>A response message of the RPC.</p>
  1066. </dd>
  1067. <dt class="field-even">Raises</dt>
  1068. <dd class="field-even"><p><strong>An RpcError exception if the read failed.</strong> – </p>
  1069. </dd>
  1070. <dt class="field-odd">Return type</dt>
  1071. <dd class="field-odd"><p>RequestType</p>
  1072. </dd>
  1073. </dl>
  1074. </dd></dl>
  1075. <dl class="py method">
  1076. <dt id="grpc.aio.ServicerContext.send_initial_metadata">
  1077. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">send_initial_metadata</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">initial_metadata</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.send_initial_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
  1078. <dd><p>Sends the initial metadata value to the client.</p>
  1079. <p>This method need not be called by implementations if they have no
  1080. metadata to add to what the gRPC runtime will transmit.</p>
  1081. <dl class="field-list simple">
  1082. <dt class="field-odd">Parameters</dt>
  1083. <dd class="field-odd"><p><strong>initial_metadata</strong> (<em>grpc.aio._metadata.Metadata</em>) – The initial <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1084. </dd>
  1085. <dt class="field-even">Return type</dt>
  1086. <dd class="field-even"><p>None</p>
  1087. </dd>
  1088. </dl>
  1089. </dd></dl>
  1090. <dl class="py method">
  1091. <dt id="grpc.aio.ServicerContext.set_code">
  1092. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">set_code</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.set_code"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.set_code" title="Permalink to this definition">¶</a></dt>
  1093. <dd><p>Sets the value to be used as status code upon RPC completion.</p>
  1094. <p>This method need not be called by method implementations if they wish
  1095. the gRPC runtime to determine the status code of the RPC.</p>
  1096. <dl class="field-list simple">
  1097. <dt class="field-odd">Parameters</dt>
  1098. <dd class="field-odd"><p><strong>code</strong> (<a class="reference internal" href="grpc.html#grpc.StatusCode" title="grpc.StatusCode"><em>grpc.StatusCode</em></a>) – A StatusCode object to be sent to the client.</p>
  1099. </dd>
  1100. <dt class="field-even">Return type</dt>
  1101. <dd class="field-even"><p>None</p>
  1102. </dd>
  1103. </dl>
  1104. </dd></dl>
  1105. <dl class="py method">
  1106. <dt id="grpc.aio.ServicerContext.set_compression">
  1107. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">set_compression</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">compression</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.set_compression"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.set_compression" title="Permalink to this definition">¶</a></dt>
  1108. <dd><p>Set the compression algorithm to be used for the entire call.</p>
  1109. <p>This is an EXPERIMENTAL method.</p>
  1110. <dl class="field-list simple">
  1111. <dt class="field-odd">Parameters</dt>
  1112. <dd class="field-odd"><p><strong>compression</strong> (<a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a>) – An element of grpc.compression, e.g.
  1113. grpc.compression.Gzip.</p>
  1114. </dd>
  1115. <dt class="field-even">Return type</dt>
  1116. <dd class="field-even"><p>None</p>
  1117. </dd>
  1118. </dl>
  1119. </dd></dl>
  1120. <dl class="py method">
  1121. <dt id="grpc.aio.ServicerContext.set_details">
  1122. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">set_details</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">details</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.set_details"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.set_details" title="Permalink to this definition">¶</a></dt>
  1123. <dd><p>Sets the value to be used the as detail string upon RPC completion.</p>
  1124. <p>This method need not be called by method implementations if they have
  1125. no details to transmit.</p>
  1126. <dl class="field-list simple">
  1127. <dt class="field-odd">Parameters</dt>
  1128. <dd class="field-odd"><p><strong>details</strong> (<em>str</em>) – A UTF-8-encodable string to be sent to the client upon
  1129. termination of the RPC.</p>
  1130. </dd>
  1131. <dt class="field-even">Return type</dt>
  1132. <dd class="field-even"><p>None</p>
  1133. </dd>
  1134. </dl>
  1135. </dd></dl>
  1136. <dl class="py method">
  1137. <dt id="grpc.aio.ServicerContext.set_trailing_metadata">
  1138. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">set_trailing_metadata</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">trailing_metadata</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.set_trailing_metadata"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.set_trailing_metadata" title="Permalink to this definition">¶</a></dt>
  1139. <dd><p>Sends the trailing metadata for the RPC.</p>
  1140. <p>This method need not be called by implementations if they have no
  1141. metadata to add to what the gRPC runtime will transmit.</p>
  1142. <dl class="field-list simple">
  1143. <dt class="field-odd">Parameters</dt>
  1144. <dd class="field-odd"><p><strong>trailing_metadata</strong> (<em>grpc.aio._metadata.Metadata</em>) – The trailing <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a>.</p>
  1145. </dd>
  1146. <dt class="field-even">Return type</dt>
  1147. <dd class="field-even"><p>None</p>
  1148. </dd>
  1149. </dl>
  1150. </dd></dl>
  1151. <dl class="py method">
  1152. <dt id="grpc.aio.ServicerContext.write">
  1153. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">write</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_server.html#ServicerContext.write"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServicerContext.write" title="Permalink to this definition">¶</a></dt>
  1154. <dd><p>Writes one message to the RPC.</p>
  1155. <p>Only one write operation is allowed simultaneously.</p>
  1156. <dl class="field-list simple">
  1157. <dt class="field-odd">Raises</dt>
  1158. <dd class="field-odd"><p><strong>An RpcError exception if the write failed.</strong> – </p>
  1159. </dd>
  1160. <dt class="field-even">Parameters</dt>
  1161. <dd class="field-even"><p><strong>message</strong> (<em>ResponseType</em>) – </p>
  1162. </dd>
  1163. <dt class="field-odd">Return type</dt>
  1164. <dd class="field-odd"><p>None</p>
  1165. </dd>
  1166. </dl>
  1167. </dd></dl>
  1168. </dd></dl>
  1169. </div>
  1170. <div class="section" id="client-side-interceptor">
  1171. <h3>Client-Side Interceptor<a class="headerlink" href="#client-side-interceptor" title="Permalink to this headline">¶</a></h3>
  1172. <dl class="py class">
  1173. <dt id="grpc.aio.ClientCallDetails">
  1174. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">ClientCallDetails</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wait_for_ready</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#ClientCallDetails"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ClientCallDetails" title="Permalink to this definition">¶</a></dt>
  1175. <dd><p>Describes an RPC to be invoked.</p>
  1176. <p>This is an EXPERIMENTAL API.</p>
  1177. <dl class="field-list simple">
  1178. <dt class="field-odd">Parameters</dt>
  1179. <dd class="field-odd"><ul class="simple">
  1180. <li><p><strong>method</strong> – The method name of the RPC.</p></li>
  1181. <li><p><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.</p></li>
  1182. <li><p><strong>metadata</strong> – Optional metadata to be transmitted to the service-side of
  1183. the RPC.</p></li>
  1184. <li><p><strong>credentials</strong> – An optional CallCredentials for the RPC.</p></li>
  1185. <li><p><strong>wait_for_ready</strong> – This is an EXPERIMENTAL argument. An optional
  1186. 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>
  1187. </ul>
  1188. </dd>
  1189. </dl>
  1190. </dd></dl>
  1191. <dl class="py class">
  1192. <dt id="grpc.aio.InterceptedUnaryUnaryCall">
  1193. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">InterceptedUnaryUnaryCall</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">interceptors</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wait_for_ready</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">method</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_serializer</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_deserializer</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loop</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#InterceptedUnaryUnaryCall"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.InterceptedUnaryUnaryCall" title="Permalink to this definition">¶</a></dt>
  1194. <dd><p>Used for running a <cite>UnaryUnaryCall</cite> wrapped by interceptors.</p>
  1195. <p>For the <cite>__await__</cite> method is it is proxied to the intercepted call only when
  1196. the interceptor task is finished.</p>
  1197. <dl class="py method">
  1198. <dt id="grpc.aio.InterceptedUnaryUnaryCall.time_remaining">
  1199. <code class="sig-name descname"><span class="pre">time_remaining</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#InterceptedUnaryUnaryCall.time_remaining"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.InterceptedUnaryUnaryCall.time_remaining" title="Permalink to this definition">¶</a></dt>
  1200. <dd><p>Describes the length of allowed time remaining for the RPC.</p>
  1201. <dl class="field-list simple">
  1202. <dt class="field-odd">Returns</dt>
  1203. <dd class="field-odd"><p>A nonnegative float indicating the length of allowed time in seconds
  1204. remaining for the RPC to complete before it is considered to have
  1205. timed out, or None if no deadline was specified for the RPC.</p>
  1206. </dd>
  1207. <dt class="field-even">Return type</dt>
  1208. <dd class="field-even"><p>Optional[float]</p>
  1209. </dd>
  1210. </dl>
  1211. </dd></dl>
  1212. </dd></dl>
  1213. <dl class="py class">
  1214. <dt id="grpc.aio.ClientInterceptor">
  1215. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">ClientInterceptor</span></code><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#ClientInterceptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1216. <dd><p>Base class used for all Aio Client Interceptor classes</p>
  1217. </dd></dl>
  1218. <dl class="py class">
  1219. <dt id="grpc.aio.UnaryUnaryClientInterceptor">
  1220. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UnaryUnaryClientInterceptor</span></code><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#UnaryUnaryClientInterceptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryUnaryClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1221. <dd><p>Affords intercepting unary-unary invocations.</p>
  1222. <dl class="py method">
  1223. <dt id="grpc.aio.UnaryUnaryClientInterceptor.intercept_unary_unary">
  1224. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">intercept_unary_unary</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">continuation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">client_call_details</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#UnaryUnaryClientInterceptor.intercept_unary_unary"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryUnaryClientInterceptor.intercept_unary_unary" title="Permalink to this definition">¶</a></dt>
  1225. <dd><p>Intercepts a unary-unary invocation asynchronously.</p>
  1226. <dl class="field-list simple">
  1227. <dt class="field-odd">Parameters</dt>
  1228. <dd class="field-odd"><ul class="simple">
  1229. <li><p><strong>continuation</strong> (<em>Callable</em><em>[</em><em>[</em><em>grpc.aio._interceptor.ClientCallDetails</em><em>, </em><em>RequestType</em><em>]</em><em>, </em><em>grpc.aio._call.UnaryUnaryCall</em><em>]</em>) – A coroutine that proceeds with the invocation by
  1230. executing the next interceptor in the chain or invoking the
  1231. actual RPC on the underlying Channel. It is the interceptor’s
  1232. responsibility to call it if it decides to move the RPC forward.
  1233. The interceptor can use
  1234. <cite>call = await continuation(client_call_details, request)</cite>
  1235. to continue with the RPC. <cite>continuation</cite> returns the call to the
  1236. RPC.</p></li>
  1237. <li><p><strong>client_call_details</strong> (<em>grpc.aio._interceptor.ClientCallDetails</em>) – A ClientCallDetails object describing the
  1238. outgoing RPC.</p></li>
  1239. <li><p><strong>request</strong> (<em>RequestType</em>) – The request value for the RPC.</p></li>
  1240. </ul>
  1241. </dd>
  1242. <dt class="field-even">Returns</dt>
  1243. <dd class="field-even"><p>An object with the RPC response.</p>
  1244. </dd>
  1245. <dt class="field-odd">Raises</dt>
  1246. <dd class="field-odd"><ul class="simple">
  1247. <li><p><a class="reference internal" href="#grpc.aio.AioRpcError" title="grpc.aio.AioRpcError"><strong>AioRpcError</strong></a> – Indicating that the RPC terminated with non-OK status.</p></li>
  1248. <li><p><strong>asyncio.CancelledError</strong> – Indicating that the RPC was canceled.</p></li>
  1249. </ul>
  1250. </dd>
  1251. <dt class="field-even">Return type</dt>
  1252. <dd class="field-even"><p>Union[grpc.aio._call.UnaryUnaryCall, ResponseType]</p>
  1253. </dd>
  1254. </dl>
  1255. </dd></dl>
  1256. </dd></dl>
  1257. <dl class="py class">
  1258. <dt id="grpc.aio.UnaryStreamClientInterceptor">
  1259. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UnaryStreamClientInterceptor</span></code><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#UnaryStreamClientInterceptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1260. <dd><p>Affords intercepting unary-stream invocations.</p>
  1261. <dl class="py method">
  1262. <dt id="grpc.aio.UnaryStreamClientInterceptor.intercept_unary_stream">
  1263. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">intercept_unary_stream</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">continuation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">client_call_details</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#UnaryStreamClientInterceptor.intercept_unary_stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamClientInterceptor.intercept_unary_stream" title="Permalink to this definition">¶</a></dt>
  1264. <dd><p>Intercepts a unary-stream invocation asynchronously.</p>
  1265. <p>The function could return the call object or an asynchronous
  1266. iterator, in case of being an asyncrhonous iterator this will
  1267. become the source of the reads done by the caller.</p>
  1268. <dl class="field-list simple">
  1269. <dt class="field-odd">Parameters</dt>
  1270. <dd class="field-odd"><ul class="simple">
  1271. <li><p><strong>continuation</strong> (<em>Callable</em><em>[</em><em>[</em><em>grpc.aio._interceptor.ClientCallDetails</em><em>, </em><em>RequestType</em><em>]</em><em>, </em><em>grpc.aio._call.UnaryStreamCall</em><em>]</em>) – A coroutine that proceeds with the invocation by
  1272. executing the next interceptor in the chain or invoking the
  1273. actual RPC on the underlying Channel. It is the interceptor’s
  1274. responsibility to call it if it decides to move the RPC forward.
  1275. The interceptor can use
  1276. <cite>call = await continuation(client_call_details, request)</cite>
  1277. to continue with the RPC. <cite>continuation</cite> returns the call to the
  1278. RPC.</p></li>
  1279. <li><p><strong>client_call_details</strong> (<em>grpc.aio._interceptor.ClientCallDetails</em>) – A ClientCallDetails object describing the
  1280. outgoing RPC.</p></li>
  1281. <li><p><strong>request</strong> (<em>RequestType</em>) – The request value for the RPC.</p></li>
  1282. </ul>
  1283. </dd>
  1284. <dt class="field-even">Returns</dt>
  1285. <dd class="field-even"><p>The RPC Call or an asynchronous iterator.</p>
  1286. </dd>
  1287. <dt class="field-odd">Raises</dt>
  1288. <dd class="field-odd"><ul class="simple">
  1289. <li><p><a class="reference internal" href="#grpc.aio.AioRpcError" title="grpc.aio.AioRpcError"><strong>AioRpcError</strong></a> – Indicating that the RPC terminated with non-OK status.</p></li>
  1290. <li><p><strong>asyncio.CancelledError</strong> – Indicating that the RPC was canceled.</p></li>
  1291. </ul>
  1292. </dd>
  1293. <dt class="field-even">Return type</dt>
  1294. <dd class="field-even"><p>Union[AsyncIterable[Any], grpc.aio._call.UnaryStreamCall]</p>
  1295. </dd>
  1296. </dl>
  1297. </dd></dl>
  1298. </dd></dl>
  1299. <dl class="py class">
  1300. <dt id="grpc.aio.StreamUnaryClientInterceptor">
  1301. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">StreamUnaryClientInterceptor</span></code><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#StreamUnaryClientInterceptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1302. <dd><p>Affords intercepting stream-unary invocations.</p>
  1303. <dl class="py method">
  1304. <dt id="grpc.aio.StreamUnaryClientInterceptor.intercept_stream_unary">
  1305. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">intercept_stream_unary</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">continuation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">client_call_details</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_iterator</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#StreamUnaryClientInterceptor.intercept_stream_unary"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryClientInterceptor.intercept_stream_unary" title="Permalink to this definition">¶</a></dt>
  1306. <dd><p>Intercepts a stream-unary invocation asynchronously.</p>
  1307. <p>Within the interceptor the usage of the call methods like <cite>write</cite> or
  1308. even awaiting the call should be done carefully, since the caller
  1309. could be expecting an untouched call, for example for start writing
  1310. messages to it.</p>
  1311. <dl class="field-list simple">
  1312. <dt class="field-odd">Parameters</dt>
  1313. <dd class="field-odd"><ul class="simple">
  1314. <li><p><strong>continuation</strong> (<em>Callable</em><em>[</em><em>[</em><em>grpc.aio._interceptor.ClientCallDetails</em><em>, </em><em>RequestType</em><em>]</em><em>, </em><em>grpc.aio._call.UnaryStreamCall</em><em>]</em>) – A coroutine that proceeds with the invocation by
  1315. executing the next interceptor in the chain or invoking the
  1316. actual RPC on the underlying Channel. It is the interceptor’s
  1317. responsibility to call it if it decides to move the RPC forward.
  1318. The interceptor can use
  1319. <cite>call = await continuation(client_call_details, request_iterator)</cite>
  1320. to continue with the RPC. <cite>continuation</cite> returns the call to the
  1321. RPC.</p></li>
  1322. <li><p><strong>client_call_details</strong> (<em>grpc.aio._interceptor.ClientCallDetails</em>) – A ClientCallDetails object describing the
  1323. outgoing RPC.</p></li>
  1324. <li><p><strong>request_iterator</strong> (<em>Union</em><em>[</em><em>Iterable</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>AsyncIterable</em><em>[</em><em>Any</em><em>]</em><em>]</em>) – The request iterator that will produce requests
  1325. for the RPC.</p></li>
  1326. </ul>
  1327. </dd>
  1328. <dt class="field-even">Returns</dt>
  1329. <dd class="field-even"><p>The RPC Call.</p>
  1330. </dd>
  1331. <dt class="field-odd">Raises</dt>
  1332. <dd class="field-odd"><ul class="simple">
  1333. <li><p><a class="reference internal" href="#grpc.aio.AioRpcError" title="grpc.aio.AioRpcError"><strong>AioRpcError</strong></a> – Indicating that the RPC terminated with non-OK status.</p></li>
  1334. <li><p><strong>asyncio.CancelledError</strong> – Indicating that the RPC was canceled.</p></li>
  1335. </ul>
  1336. </dd>
  1337. <dt class="field-even">Return type</dt>
  1338. <dd class="field-even"><p>grpc.aio._call.StreamUnaryCall</p>
  1339. </dd>
  1340. </dl>
  1341. </dd></dl>
  1342. </dd></dl>
  1343. <dl class="py class">
  1344. <dt id="grpc.aio.StreamStreamClientInterceptor">
  1345. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">StreamStreamClientInterceptor</span></code><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#StreamStreamClientInterceptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamClientInterceptor" title="Permalink to this definition">¶</a></dt>
  1346. <dd><p>Affords intercepting stream-stream invocations.</p>
  1347. <dl class="py method">
  1348. <dt id="grpc.aio.StreamStreamClientInterceptor.intercept_stream_stream">
  1349. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">intercept_stream_stream</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">continuation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">client_call_details</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_iterator</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#StreamStreamClientInterceptor.intercept_stream_stream"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamClientInterceptor.intercept_stream_stream" title="Permalink to this definition">¶</a></dt>
  1350. <dd><p>Intercepts a stream-stream invocation asynchronously.</p>
  1351. <p>Within the interceptor the usage of the call methods like <cite>write</cite> or
  1352. even awaiting the call should be done carefully, since the caller
  1353. could be expecting an untouched call, for example for start writing
  1354. messages to it.</p>
  1355. <p>The function could return the call object or an asynchronous
  1356. iterator, in case of being an asyncrhonous iterator this will
  1357. become the source of the reads done by the caller.</p>
  1358. <dl class="field-list simple">
  1359. <dt class="field-odd">Parameters</dt>
  1360. <dd class="field-odd"><ul class="simple">
  1361. <li><p><strong>continuation</strong> (<em>Callable</em><em>[</em><em>[</em><em>grpc.aio._interceptor.ClientCallDetails</em><em>, </em><em>RequestType</em><em>]</em><em>, </em><em>grpc.aio._call.UnaryStreamCall</em><em>]</em>) – A coroutine that proceeds with the invocation by
  1362. executing the next interceptor in the chain or invoking the
  1363. actual RPC on the underlying Channel. It is the interceptor’s
  1364. responsibility to call it if it decides to move the RPC forward.
  1365. The interceptor can use
  1366. <cite>call = await continuation(client_call_details, request_iterator)</cite>
  1367. to continue with the RPC. <cite>continuation</cite> returns the call to the
  1368. RPC.</p></li>
  1369. <li><p><strong>client_call_details</strong> (<em>grpc.aio._interceptor.ClientCallDetails</em>) – A ClientCallDetails object describing the
  1370. outgoing RPC.</p></li>
  1371. <li><p><strong>request_iterator</strong> (<em>Union</em><em>[</em><em>Iterable</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>AsyncIterable</em><em>[</em><em>Any</em><em>]</em><em>]</em>) – The request iterator that will produce requests
  1372. for the RPC.</p></li>
  1373. </ul>
  1374. </dd>
  1375. <dt class="field-even">Returns</dt>
  1376. <dd class="field-even"><p>The RPC Call or an asynchronous iterator.</p>
  1377. </dd>
  1378. <dt class="field-odd">Raises</dt>
  1379. <dd class="field-odd"><ul class="simple">
  1380. <li><p><a class="reference internal" href="#grpc.aio.AioRpcError" title="grpc.aio.AioRpcError"><strong>AioRpcError</strong></a> – Indicating that the RPC terminated with non-OK status.</p></li>
  1381. <li><p><strong>asyncio.CancelledError</strong> – Indicating that the RPC was canceled.</p></li>
  1382. </ul>
  1383. </dd>
  1384. <dt class="field-even">Return type</dt>
  1385. <dd class="field-even"><p>Union[AsyncIterable[Any], grpc.aio._call.StreamStreamCall]</p>
  1386. </dd>
  1387. </dl>
  1388. </dd></dl>
  1389. </dd></dl>
  1390. </div>
  1391. <div class="section" id="server-side-interceptor">
  1392. <h3>Server-Side Interceptor<a class="headerlink" href="#server-side-interceptor" title="Permalink to this headline">¶</a></h3>
  1393. <dl class="py class">
  1394. <dt id="grpc.aio.ServerInterceptor">
  1395. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">ServerInterceptor</span></code><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#ServerInterceptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServerInterceptor" title="Permalink to this definition">¶</a></dt>
  1396. <dd><p>Affords intercepting incoming RPCs on the service-side.</p>
  1397. <p>This is an EXPERIMENTAL API.</p>
  1398. <dl class="py method">
  1399. <dt id="grpc.aio.ServerInterceptor.intercept_service">
  1400. <em class="property"><span class="pre">abstract</span> <span class="pre">async</span> </em><code class="sig-name descname"><span class="pre">intercept_service</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">continuation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">handler_call_details</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_interceptor.html#ServerInterceptor.intercept_service"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.ServerInterceptor.intercept_service" title="Permalink to this definition">¶</a></dt>
  1401. <dd><p>Intercepts incoming RPCs before handing them over to a handler.</p>
  1402. <dl class="field-list simple">
  1403. <dt class="field-odd">Parameters</dt>
  1404. <dd class="field-odd"><ul class="simple">
  1405. <li><p><strong>continuation</strong> (<em>Callable</em><em>[</em><em>[</em><a class="reference internal" href="grpc.html#grpc.HandlerCallDetails" title="grpc.HandlerCallDetails"><em>grpc.HandlerCallDetails</em></a><em>]</em><em>, </em><em>Awaitable</em><em>[</em><a class="reference internal" href="grpc.html#grpc.RpcMethodHandler" title="grpc.RpcMethodHandler"><em>grpc.RpcMethodHandler</em></a><em>]</em><em>]</em>) – A function that takes a HandlerCallDetails and
  1406. proceeds to invoke the next interceptor in the chain, if any,
  1407. or the RPC handler lookup logic, with the call details passed
  1408. as an argument, and returns an RpcMethodHandler instance if
  1409. the RPC is considered serviced, or None otherwise.</p></li>
  1410. <li><p><strong>handler_call_details</strong> (<a class="reference internal" href="grpc.html#grpc.HandlerCallDetails" title="grpc.HandlerCallDetails"><em>grpc.HandlerCallDetails</em></a>) – A HandlerCallDetails describing the RPC.</p></li>
  1411. </ul>
  1412. </dd>
  1413. <dt class="field-even">Returns</dt>
  1414. <dd class="field-even"><p>An RpcMethodHandler with which the RPC may be serviced if the
  1415. interceptor chooses to service this RPC, or None otherwise.</p>
  1416. </dd>
  1417. <dt class="field-odd">Return type</dt>
  1418. <dd class="field-odd"><p><a class="reference internal" href="grpc.html#grpc.RpcMethodHandler" title="grpc.RpcMethodHandler">grpc.RpcMethodHandler</a></p>
  1419. </dd>
  1420. </dl>
  1421. </dd></dl>
  1422. </dd></dl>
  1423. </div>
  1424. <div class="section" id="multi-callable-interfaces">
  1425. <h3>Multi-Callable Interfaces<a class="headerlink" href="#multi-callable-interfaces" title="Permalink to this headline">¶</a></h3>
  1426. <dl class="py class">
  1427. <dt id="grpc.aio.UnaryUnaryMultiCallable">
  1428. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UnaryUnaryMultiCallable</span></code><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#UnaryUnaryMultiCallable"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryUnaryMultiCallable" title="Permalink to this definition">¶</a></dt>
  1429. <dd><p>Enables asynchronous invocation of a unary-call RPC.</p>
  1430. <dl class="py method">
  1431. <dt id="grpc.aio.UnaryUnaryMultiCallable.__call__">
  1432. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__call__</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wait_for_ready</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#UnaryUnaryMultiCallable.__call__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryUnaryMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1433. <dd><p>Asynchronously invokes the underlying RPC.</p>
  1434. <dl class="field-list simple">
  1435. <dt class="field-odd">Parameters</dt>
  1436. <dd class="field-odd"><ul class="simple">
  1437. <li><p><strong>request</strong> (<em>Any</em>) – The request value for the RPC.</p></li>
  1438. <li><p><strong>timeout</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – An optional duration of time in seconds to allow
  1439. for the RPC.</p></li>
  1440. <li><p><strong>metadata</strong> (<em>Optional</em><em>[</em><em>grpc.aio._metadata.Metadata</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1441. service-side of the RPC.</p></li>
  1442. <li><p><strong>credentials</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.CallCredentials" title="grpc.CallCredentials"><em>grpc.CallCredentials</em></a><em>]</em>) – An optional CallCredentials for the RPC. Only valid for
  1443. secure Channel.</p></li>
  1444. <li><p><strong>wait_for_ready</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – This is an EXPERIMENTAL argument. An optional
  1445. 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>
  1446. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An element of grpc.compression, e.g.
  1447. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1448. </ul>
  1449. </dd>
  1450. <dt class="field-even">Returns</dt>
  1451. <dd class="field-even"><p>A UnaryUnaryCall object.</p>
  1452. </dd>
  1453. <dt class="field-odd">Raises</dt>
  1454. <dd class="field-odd"><p><a class="reference internal" href="grpc.html#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicates that the RPC terminated with non-OK status. The
  1455. raised RpcError will also be a Call for the RPC affording the RPC’s
  1456. metadata, status code, and details.</p>
  1457. </dd>
  1458. <dt class="field-even">Return type</dt>
  1459. <dd class="field-even"><p>grpc.aio._base_call.UnaryUnaryCall</p>
  1460. </dd>
  1461. </dl>
  1462. </dd></dl>
  1463. </dd></dl>
  1464. <dl class="py class">
  1465. <dt id="grpc.aio.UnaryStreamMultiCallable">
  1466. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">UnaryStreamMultiCallable</span></code><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#UnaryStreamMultiCallable"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamMultiCallable" title="Permalink to this definition">¶</a></dt>
  1467. <dd><p>Enables asynchronous invocation of a server-streaming RPC.</p>
  1468. <dl class="py method">
  1469. <dt id="grpc.aio.UnaryStreamMultiCallable.__call__">
  1470. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__call__</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wait_for_ready</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#UnaryStreamMultiCallable.__call__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.UnaryStreamMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1471. <dd><p>Asynchronously invokes the underlying RPC.</p>
  1472. <dl class="field-list simple">
  1473. <dt class="field-odd">Parameters</dt>
  1474. <dd class="field-odd"><ul class="simple">
  1475. <li><p><strong>request</strong> (<em>Any</em>) – The request value for the RPC.</p></li>
  1476. <li><p><strong>timeout</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – An optional duration of time in seconds to allow
  1477. for the RPC.</p></li>
  1478. <li><p><strong>metadata</strong> (<em>Optional</em><em>[</em><em>grpc.aio._metadata.Metadata</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1479. service-side of the RPC.</p></li>
  1480. <li><p><strong>credentials</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.CallCredentials" title="grpc.CallCredentials"><em>grpc.CallCredentials</em></a><em>]</em>) – An optional CallCredentials for the RPC. Only valid for
  1481. secure Channel.</p></li>
  1482. <li><p><strong>wait_for_ready</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – This is an EXPERIMENTAL argument. An optional
  1483. 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>
  1484. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An element of grpc.compression, e.g.
  1485. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1486. </ul>
  1487. </dd>
  1488. <dt class="field-even">Returns</dt>
  1489. <dd class="field-even"><p>A UnaryStreamCall object.</p>
  1490. </dd>
  1491. <dt class="field-odd">Raises</dt>
  1492. <dd class="field-odd"><p><a class="reference internal" href="grpc.html#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicates that the RPC terminated with non-OK status. The
  1493. raised RpcError will also be a Call for the RPC affording the RPC’s
  1494. metadata, status code, and details.</p>
  1495. </dd>
  1496. <dt class="field-even">Return type</dt>
  1497. <dd class="field-even"><p>grpc.aio._base_call.UnaryStreamCall</p>
  1498. </dd>
  1499. </dl>
  1500. </dd></dl>
  1501. </dd></dl>
  1502. <dl class="py class">
  1503. <dt id="grpc.aio.StreamUnaryMultiCallable">
  1504. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">StreamUnaryMultiCallable</span></code><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#StreamUnaryMultiCallable"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryMultiCallable" title="Permalink to this definition">¶</a></dt>
  1505. <dd><p>Enables asynchronous invocation of a client-streaming RPC.</p>
  1506. <dl class="py method">
  1507. <dt id="grpc.aio.StreamUnaryMultiCallable.__call__">
  1508. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__call__</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request_iterator</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wait_for_ready</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#StreamUnaryMultiCallable.__call__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamUnaryMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1509. <dd><p>Asynchronously invokes the underlying RPC.</p>
  1510. <dl class="field-list simple">
  1511. <dt class="field-odd">Parameters</dt>
  1512. <dd class="field-odd"><ul class="simple">
  1513. <li><p><strong>request_iterator</strong> (<em>Optional</em><em>[</em><em>Union</em><em>[</em><em>Iterable</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>AsyncIterable</em><em>[</em><em>Any</em><em>]</em><em>]</em><em>]</em>) – An optional async iterable or iterable of request
  1514. messages for the RPC.</p></li>
  1515. <li><p><strong>timeout</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – An optional duration of time in seconds to allow
  1516. for the RPC.</p></li>
  1517. <li><p><strong>metadata</strong> (<em>Optional</em><em>[</em><em>grpc.aio._metadata.Metadata</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1518. service-side of the RPC.</p></li>
  1519. <li><p><strong>credentials</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.CallCredentials" title="grpc.CallCredentials"><em>grpc.CallCredentials</em></a><em>]</em>) – An optional CallCredentials for the RPC. Only valid for
  1520. secure Channel.</p></li>
  1521. <li><p><strong>wait_for_ready</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – This is an EXPERIMENTAL argument. An optional
  1522. 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>
  1523. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An element of grpc.compression, e.g.
  1524. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1525. </ul>
  1526. </dd>
  1527. <dt class="field-even">Returns</dt>
  1528. <dd class="field-even"><p>A StreamUnaryCall object.</p>
  1529. </dd>
  1530. <dt class="field-odd">Raises</dt>
  1531. <dd class="field-odd"><p><a class="reference internal" href="grpc.html#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicates that the RPC terminated with non-OK status. The
  1532. raised RpcError will also be a Call for the RPC affording the RPC’s
  1533. metadata, status code, and details.</p>
  1534. </dd>
  1535. <dt class="field-even">Return type</dt>
  1536. <dd class="field-even"><p>grpc.aio._base_call.StreamUnaryCall</p>
  1537. </dd>
  1538. </dl>
  1539. </dd></dl>
  1540. </dd></dl>
  1541. <dl class="py class">
  1542. <dt id="grpc.aio.StreamStreamMultiCallable">
  1543. <em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">grpc.aio.</span></code><code class="sig-name descname"><span class="pre">StreamStreamMultiCallable</span></code><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#StreamStreamMultiCallable"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamMultiCallable" title="Permalink to this definition">¶</a></dt>
  1544. <dd><p>Enables asynchronous invocation of a bidirectional-streaming RPC.</p>
  1545. <dl class="py method">
  1546. <dt id="grpc.aio.StreamStreamMultiCallable.__call__">
  1547. <em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">__call__</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">request_iterator</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">credentials</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wait_for_ready</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">compression</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/aio/_base_channel.html#StreamStreamMultiCallable.__call__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#grpc.aio.StreamStreamMultiCallable.__call__" title="Permalink to this definition">¶</a></dt>
  1548. <dd><p>Asynchronously invokes the underlying RPC.</p>
  1549. <dl class="field-list simple">
  1550. <dt class="field-odd">Parameters</dt>
  1551. <dd class="field-odd"><ul class="simple">
  1552. <li><p><strong>request_iterator</strong> (<em>Optional</em><em>[</em><em>Union</em><em>[</em><em>Iterable</em><em>[</em><em>Any</em><em>]</em><em>, </em><em>AsyncIterable</em><em>[</em><em>Any</em><em>]</em><em>]</em><em>]</em>) – An optional async iterable or iterable of request
  1553. messages for the RPC.</p></li>
  1554. <li><p><strong>timeout</strong> (<em>Optional</em><em>[</em><em>float</em><em>]</em>) – An optional duration of time in seconds to allow
  1555. for the RPC.</p></li>
  1556. <li><p><strong>metadata</strong> (<em>Optional</em><em>[</em><em>grpc.aio._metadata.Metadata</em><em>]</em>) – Optional <a class="reference internal" href="glossary.html#term-metadata"><span class="xref std std-term">metadata</span></a> to be transmitted to the
  1557. service-side of the RPC.</p></li>
  1558. <li><p><strong>credentials</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.CallCredentials" title="grpc.CallCredentials"><em>grpc.CallCredentials</em></a><em>]</em>) – An optional CallCredentials for the RPC. Only valid for
  1559. secure Channel.</p></li>
  1560. <li><p><strong>wait_for_ready</strong> (<em>Optional</em><em>[</em><em>bool</em><em>]</em>) – This is an EXPERIMENTAL argument. An optional
  1561. 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>
  1562. <li><p><strong>compression</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="grpc.html#grpc.Compression" title="grpc.Compression"><em>grpc.Compression</em></a><em>]</em>) – An element of grpc.compression, e.g.
  1563. grpc.compression.Gzip. This is an EXPERIMENTAL option.</p></li>
  1564. </ul>
  1565. </dd>
  1566. <dt class="field-even">Returns</dt>
  1567. <dd class="field-even"><p>A StreamStreamCall object.</p>
  1568. </dd>
  1569. <dt class="field-odd">Raises</dt>
  1570. <dd class="field-odd"><p><a class="reference internal" href="grpc.html#grpc.RpcError" title="grpc.RpcError"><strong>RpcError</strong></a> – Indicates that the RPC terminated with non-OK status. The
  1571. raised RpcError will also be a Call for the RPC affording the RPC’s
  1572. metadata, status code, and details.</p>
  1573. </dd>
  1574. <dt class="field-even">Return type</dt>
  1575. <dd class="field-even"><p>grpc.aio._base_call.StreamStreamCall</p>
  1576. </dd>
  1577. </dl>
  1578. </dd></dl>
  1579. </dd></dl>
  1580. </div>
  1581. </div>
  1582. </div>
  1583. </div>
  1584. </div>
  1585. </div>
  1586. <div class="clearer"></div>
  1587. </div>
  1588. <div class="footer">
  1589. &copy;2020, The gRPC Authors.
  1590. |
  1591. <a href="_sources/grpc_asyncio.rst.txt"
  1592. rel="nofollow">Page source</a>
  1593. </div>
  1594. <script type="text/javascript">
  1595. var _gaq = _gaq || [];
  1596. _gaq.push(['_setAccount', 'UA-60127042-1']);
  1597. _gaq.push(['_setDomainName', 'none']);
  1598. _gaq.push(['_setAllowLinker', true]);
  1599. _gaq.push(['_trackPageview']);
  1600. (function() {
  1601. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  1602. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  1603. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  1604. })();
  1605. </script>
  1606. </body>
  1607. </html>