grpc_asyncio.html 116 KB

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