grpc.html 141 KB

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