grpc.html 138 KB

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