grpc.html 118 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088
  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.6.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.6.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. </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.6.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, and secure_channel
  601. consumes 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. <dl class="docutils">
  608. <dt>An encapsulation of the data required to assert an identity over a</dt>
  609. <dd>channel.</dd>
  610. </dl>
  611. <p>A CallCredentials may be composed with ChannelCredentials to always assert
  612. identity for every call over that Channel.</p>
  613. <p>This class has no supported interface - it exists to define the type of its
  614. instances and its instances exist to be passed to other functions.</p>
  615. </dd></dl>
  616. <dl class="class">
  617. <dt id="grpc.AuthMetadataContext">
  618. <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>
  619. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  620. <p>Provides information to call credentials metadata plugins.</p>
  621. <dl class="attribute">
  622. <dt id="grpc.AuthMetadataContext.service_url">
  623. <code class="descname">service_url</code><a class="headerlink" href="#grpc.AuthMetadataContext.service_url" title="Permalink to this definition">¶</a></dt>
  624. <dd><p>A string URL of the service being called into.</p>
  625. </dd></dl>
  626. <dl class="attribute">
  627. <dt id="grpc.AuthMetadataContext.method_name">
  628. <code class="descname">method_name</code><a class="headerlink" href="#grpc.AuthMetadataContext.method_name" title="Permalink to this definition">¶</a></dt>
  629. <dd><p>A string of the fully qualified method name being called.</p>
  630. </dd></dl>
  631. </dd></dl>
  632. <dl class="class">
  633. <dt id="grpc.AuthMetadataPluginCallback">
  634. <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>
  635. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  636. <p>Callback object received by a metadata plugin.</p>
  637. <dl class="method">
  638. <dt id="grpc.AuthMetadataPluginCallback.__call__">
  639. <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>
  640. <dd><dl class="docutils">
  641. <dt>Inform the gRPC runtime of the metadata to construct a</dt>
  642. <dd>CallCredentials.</dd>
  643. </dl>
  644. <table class="docutils field-list" frame="void" rules="none">
  645. <col class="field-name" />
  646. <col class="field-body" />
  647. <tbody valign="top">
  648. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  649. <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>
  650. <li><strong>error</strong> – An Exception to indicate error or None to indicate success.</li>
  651. </ul>
  652. </td>
  653. </tr>
  654. </tbody>
  655. </table>
  656. </dd></dl>
  657. </dd></dl>
  658. <dl class="class">
  659. <dt id="grpc.AuthMetadataPlugin">
  660. <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>
  661. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  662. <p>A specification for custom authentication.</p>
  663. <dl class="method">
  664. <dt id="grpc.AuthMetadataPlugin.__call__">
  665. <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>
  666. <dd><p>Implements authentication by passing metadata to a callback.</p>
  667. <p>Implementations of this method must not block.</p>
  668. <table class="docutils field-list" frame="void" rules="none">
  669. <col class="field-name" />
  670. <col class="field-body" />
  671. <tbody valign="top">
  672. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  673. <li><strong>context</strong> – An AuthMetadataContext providing information on the RPC that the
  674. plugin is being called to authenticate.</li>
  675. <li><strong>callback</strong> – An AuthMetadataPluginCallback to be invoked either synchronously
  676. or asynchronously.</li>
  677. </ul>
  678. </td>
  679. </tr>
  680. </tbody>
  681. </table>
  682. </dd></dl>
  683. </dd></dl>
  684. <dl class="class">
  685. <dt id="grpc.ServerCredentials">
  686. <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>
  687. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  688. <p>An encapsulation of the data required to open a secure port on a Server.</p>
  689. <p>This class has no supported interface - it exists to define the type of its
  690. instances and its instances exist to be passed to other functions.</p>
  691. </dd></dl>
  692. <dl class="class">
  693. <dt id="grpc.UnaryUnaryMultiCallable">
  694. <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>
  695. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  696. <p>Affords invoking a unary-unary RPC from client-side.</p>
  697. <dl class="method">
  698. <dt id="grpc.UnaryUnaryMultiCallable.__call__">
  699. <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>
  700. <dd><p>Synchronously invokes the underlying RPC.</p>
  701. <table class="docutils field-list" frame="void" rules="none">
  702. <col class="field-name" />
  703. <col class="field-body" />
  704. <tbody valign="top">
  705. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  706. <li><strong>request</strong> – The request value for the RPC.</li>
  707. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.</li>
  708. <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
  709. service-side of the RPC.</li>
  710. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  711. </ul>
  712. </td>
  713. </tr>
  714. <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>
  715. </td>
  716. </tr>
  717. <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
  718. raised RpcError will also be a Call for the RPC affording the RPC’s
  719. metadata, status code, and details.</p>
  720. </td>
  721. </tr>
  722. </tbody>
  723. </table>
  724. </dd></dl>
  725. <dl class="method">
  726. <dt id="grpc.UnaryUnaryMultiCallable.future">
  727. <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>
  728. <dd><p>Asynchronously invokes the underlying RPC.</p>
  729. <table class="docutils field-list" frame="void" rules="none">
  730. <col class="field-name" />
  731. <col class="field-body" />
  732. <tbody valign="top">
  733. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  734. <li><strong>request</strong> – The request value for the RPC.</li>
  735. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.</li>
  736. <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
  737. service-side of the RPC.</li>
  738. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  739. </ul>
  740. </td>
  741. </tr>
  742. <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
  743. RPC completion, the return Call-Future’s result value will be the
  744. response message of the RPC. Should the event terminate with non-OK
  745. status, the returned Call-Future’s exception value will be an RpcError.</p>
  746. </td>
  747. </tr>
  748. </tbody>
  749. </table>
  750. </dd></dl>
  751. <dl class="method">
  752. <dt id="grpc.UnaryUnaryMultiCallable.with_call">
  753. <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>
  754. <dd><p>Synchronously invokes the underlying RPC.</p>
  755. <table class="docutils field-list" frame="void" rules="none">
  756. <col class="field-name" />
  757. <col class="field-body" />
  758. <tbody valign="top">
  759. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  760. <li><strong>request</strong> – The request value for the RPC.</li>
  761. <li><strong>timeout</strong> – An optional durating of time in seconds to allow for the RPC.</li>
  762. <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
  763. service-side of the RPC.</li>
  764. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  765. </ul>
  766. </td>
  767. </tr>
  768. <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>
  769. </td>
  770. </tr>
  771. <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
  772. raised RpcError will also be a Call for the RPC affording the RPC’s
  773. metadata, status code, and details.</p>
  774. </td>
  775. </tr>
  776. </tbody>
  777. </table>
  778. </dd></dl>
  779. </dd></dl>
  780. <dl class="class">
  781. <dt id="grpc.UnaryStreamMultiCallable">
  782. <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>
  783. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  784. <p>Affords invoking a unary-stream RPC from client-side.</p>
  785. <dl class="method">
  786. <dt id="grpc.UnaryStreamMultiCallable.__call__">
  787. <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>
  788. <dd><p>Invokes the underlying RPC.</p>
  789. <table class="docutils field-list" frame="void" rules="none">
  790. <col class="field-name" />
  791. <col class="field-body" />
  792. <tbody valign="top">
  793. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  794. <li><strong>request</strong> – The request value for the RPC.</li>
  795. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.
  796. If None, the timeout is considered infinite.</li>
  797. <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
  798. service-side of the RPC.</li>
  799. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  800. </ul>
  801. </td>
  802. </tr>
  803. <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
  804. values. Drawing response values from the returned Call-iterator may
  805. raise RpcError indicating termination of the RPC with non-OK status.</p>
  806. </td>
  807. </tr>
  808. </tbody>
  809. </table>
  810. </dd></dl>
  811. </dd></dl>
  812. <dl class="class">
  813. <dt id="grpc.StreamUnaryMultiCallable">
  814. <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>
  815. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  816. <p>Affords invoking a stream-unary RPC from client-side.</p>
  817. <dl class="method">
  818. <dt id="grpc.StreamUnaryMultiCallable.__call__">
  819. <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>
  820. <dd><p>Synchronously invokes the underlying RPC.</p>
  821. <table class="docutils field-list" frame="void" rules="none">
  822. <col class="field-name" />
  823. <col class="field-body" />
  824. <tbody valign="top">
  825. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  826. <li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li>
  827. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.
  828. If None, the timeout is considered infinite.</li>
  829. <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
  830. service-side of the RPC.</li>
  831. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  832. </ul>
  833. </td>
  834. </tr>
  835. <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>
  836. </td>
  837. </tr>
  838. <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
  839. raised RpcError will also implement grpc.Call, affording methods
  840. such as metadata, code, and details.</p>
  841. </td>
  842. </tr>
  843. </tbody>
  844. </table>
  845. </dd></dl>
  846. <dl class="method">
  847. <dt id="grpc.StreamUnaryMultiCallable.future">
  848. <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>
  849. <dd><p>Asynchronously invokes the underlying RPC on the client.</p>
  850. <table class="docutils field-list" frame="void" rules="none">
  851. <col class="field-name" />
  852. <col class="field-body" />
  853. <tbody valign="top">
  854. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  855. <li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li>
  856. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.
  857. If None, the timeout is considered infinite.</li>
  858. <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
  859. service-side of the RPC.</li>
  860. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  861. </ul>
  862. </td>
  863. </tr>
  864. <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
  865. RPC completion, the return Call-Future’s result value will be the
  866. response message of the RPC. Should the event terminate with non-OK
  867. status, the returned Call-Future’s exception value will be an RpcError.</p>
  868. </td>
  869. </tr>
  870. </tbody>
  871. </table>
  872. </dd></dl>
  873. <dl class="method">
  874. <dt id="grpc.StreamUnaryMultiCallable.with_call">
  875. <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>
  876. <dd><p>Synchronously invokes the underlying RPC on the client.</p>
  877. <table class="docutils field-list" frame="void" rules="none">
  878. <col class="field-name" />
  879. <col class="field-body" />
  880. <tbody valign="top">
  881. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  882. <li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li>
  883. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.
  884. If None, the timeout is considered infinite.</li>
  885. <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
  886. service-side of the RPC.</li>
  887. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  888. </ul>
  889. </td>
  890. </tr>
  891. <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>
  892. </td>
  893. </tr>
  894. <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
  895. raised RpcError will also be a Call for the RPC affording the RPC’s
  896. metadata, status code, and details.</p>
  897. </td>
  898. </tr>
  899. </tbody>
  900. </table>
  901. </dd></dl>
  902. </dd></dl>
  903. <dl class="class">
  904. <dt id="grpc.StreamStreamMultiCallable">
  905. <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>
  906. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  907. <p>Affords invoking a stream-stream RPC on client-side.</p>
  908. <dl class="method">
  909. <dt id="grpc.StreamStreamMultiCallable.__call__">
  910. <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>
  911. <dd><p>Invokes the underlying RPC on the client.</p>
  912. <table class="docutils field-list" frame="void" rules="none">
  913. <col class="field-name" />
  914. <col class="field-body" />
  915. <tbody valign="top">
  916. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  917. <li><strong>request_iterator</strong> – An iterator that yields request values for the RPC.</li>
  918. <li><strong>timeout</strong> – An optional duration of time in seconds to allow for the RPC.
  919. if not specified the timeout is considered infinite.</li>
  920. <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
  921. service-side of the RPC.</li>
  922. <li><strong>credentials</strong> – An optional CallCredentials for the RPC.</li>
  923. </ul>
  924. </td>
  925. </tr>
  926. <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
  927. values. Drawing response values from the returned Call-iterator may
  928. raise RpcError indicating termination of the RPC with non-OK status.</p>
  929. </td>
  930. </tr>
  931. </tbody>
  932. </table>
  933. </dd></dl>
  934. </dd></dl>
  935. <dl class="class">
  936. <dt id="grpc.Channel">
  937. <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>
  938. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  939. <p>Affords RPC invocation via generic methods on client-side.</p>
  940. <dl class="method">
  941. <dt id="grpc.Channel.stream_stream">
  942. <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>
  943. <dd><p>Creates a StreamStreamMultiCallable for a stream-stream method.</p>
  944. <table class="docutils field-list" frame="void" rules="none">
  945. <col class="field-name" />
  946. <col class="field-body" />
  947. <tbody valign="top">
  948. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  949. <li><strong>method</strong> – The name of the RPC method.</li>
  950. <li><strong>request_serializer</strong> – Optional behaviour for serializing the request
  951. message. Request goes unserialized in case None is passed.</li>
  952. <li><strong>response_deserializer</strong> – Optional behaviour for deserializing the response
  953. message. Response goes undeserialized in case None is passed.</li>
  954. </ul>
  955. </td>
  956. </tr>
  957. <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>
  958. </td>
  959. </tr>
  960. </tbody>
  961. </table>
  962. </dd></dl>
  963. <dl class="method">
  964. <dt id="grpc.Channel.stream_unary">
  965. <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>
  966. <dd><p>Creates a StreamUnaryMultiCallable for a stream-unary method.</p>
  967. <table class="docutils field-list" frame="void" rules="none">
  968. <col class="field-name" />
  969. <col class="field-body" />
  970. <tbody valign="top">
  971. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  972. <li><strong>method</strong> – The name of the RPC method.</li>
  973. <li><strong>request_serializer</strong> – Optional behaviour for serializing the request
  974. message. Request goes unserialized in case None is passed.</li>
  975. <li><strong>response_deserializer</strong> – Optional behaviour for deserializing the response
  976. message. Response goes undeserialized in case None is passed.</li>
  977. </ul>
  978. </td>
  979. </tr>
  980. <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>
  981. </td>
  982. </tr>
  983. </tbody>
  984. </table>
  985. </dd></dl>
  986. <dl class="method">
  987. <dt id="grpc.Channel.subscribe">
  988. <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>
  989. <dd><p>Subscribe to this Channel’s connectivity state machine.</p>
  990. <p>A Channel may be in any of the states described by ChannelConnectivity.
  991. This method allows application to monitor the state transitions.
  992. The typical use case is to debug or gain better visibility into gRPC
  993. runtime’s state.</p>
  994. <table class="docutils field-list" frame="void" rules="none">
  995. <col class="field-name" />
  996. <col class="field-body" />
  997. <tbody valign="top">
  998. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  999. <li><strong>callback</strong> – A callable to be invoked with ChannelConnectivity argument.
  1000. ChannelConnectivity describes current state of the channel.
  1001. The callable will be invoked immediately upon subscription and again for
  1002. every change to ChannelConnectivity until it is unsubscribed or this
  1003. Channel object goes out of scope.</li>
  1004. <li><strong>try_to_connect</strong> – A boolean indicating whether or not this Channel should
  1005. attempt to connect immediately. If set to False, gRPC runtime decides
  1006. when to connect.</li>
  1007. </ul>
  1008. </td>
  1009. </tr>
  1010. </tbody>
  1011. </table>
  1012. </dd></dl>
  1013. <dl class="method">
  1014. <dt id="grpc.Channel.unary_stream">
  1015. <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>
  1016. <dd><p>Creates a UnaryStreamMultiCallable for a unary-stream method.</p>
  1017. <table class="docutils field-list" frame="void" rules="none">
  1018. <col class="field-name" />
  1019. <col class="field-body" />
  1020. <tbody valign="top">
  1021. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1022. <li><strong>method</strong> – The name of the RPC method.</li>
  1023. <li><strong>request_serializer</strong> – Optional behaviour for serializing the request
  1024. message. Request goes unserialized in case None is passed.</li>
  1025. <li><strong>response_deserializer</strong> – Optional behaviour for deserializing the response
  1026. message. Response goes undeserialized in case None is passed.</li>
  1027. </ul>
  1028. </td>
  1029. </tr>
  1030. <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>
  1031. </td>
  1032. </tr>
  1033. </tbody>
  1034. </table>
  1035. </dd></dl>
  1036. <dl class="method">
  1037. <dt id="grpc.Channel.unary_unary">
  1038. <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>
  1039. <dd><p>Creates a UnaryUnaryMultiCallable for a unary-unary method.</p>
  1040. <table class="docutils field-list" frame="void" rules="none">
  1041. <col class="field-name" />
  1042. <col class="field-body" />
  1043. <tbody valign="top">
  1044. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1045. <li><strong>method</strong> – The name of the RPC method.</li>
  1046. <li><strong>request_serializer</strong> – Optional behaviour for serializing the request
  1047. message. Request goes unserialized in case None is passed.</li>
  1048. <li><strong>response_deserializer</strong> – Optional behaviour for deserializing the response
  1049. message. Response goes undeserialized in case None is passed.</li>
  1050. </ul>
  1051. </td>
  1052. </tr>
  1053. <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>
  1054. </td>
  1055. </tr>
  1056. </tbody>
  1057. </table>
  1058. </dd></dl>
  1059. <dl class="method">
  1060. <dt id="grpc.Channel.unsubscribe">
  1061. <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>
  1062. <dd><p>Unsubscribes a subscribed callback from this Channel’s connectivity.</p>
  1063. <table class="docutils field-list" frame="void" rules="none">
  1064. <col class="field-name" />
  1065. <col class="field-body" />
  1066. <tbody valign="top">
  1067. <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
  1068. been passed to its “subscribe” method.</td>
  1069. </tr>
  1070. </tbody>
  1071. </table>
  1072. </dd></dl>
  1073. </dd></dl>
  1074. <dl class="class">
  1075. <dt id="grpc.ServicerContext">
  1076. <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>
  1077. <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>
  1078. <p>A context object passed to method implementations.</p>
  1079. <dl class="method">
  1080. <dt id="grpc.ServicerContext.auth_context">
  1081. <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>
  1082. <dd><p>Gets the auth context for the call.</p>
  1083. <table class="docutils field-list" frame="void" rules="none">
  1084. <col class="field-name" />
  1085. <col class="field-body" />
  1086. <tbody valign="top">
  1087. <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>
  1088. </tr>
  1089. </tbody>
  1090. </table>
  1091. </dd></dl>
  1092. <dl class="method">
  1093. <dt id="grpc.ServicerContext.invocation_metadata">
  1094. <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>
  1095. <dd><p>Accesses the metadata from the sent by the client.</p>
  1096. <table class="docutils field-list" frame="void" rules="none">
  1097. <col class="field-name" />
  1098. <col class="field-body" />
  1099. <tbody valign="top">
  1100. <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>
  1101. </tr>
  1102. </tbody>
  1103. </table>
  1104. </dd></dl>
  1105. <dl class="method">
  1106. <dt id="grpc.ServicerContext.peer">
  1107. <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>
  1108. <dd><p>Identifies the peer that invoked the RPC being serviced.</p>
  1109. <table class="docutils field-list" frame="void" rules="none">
  1110. <col class="field-name" />
  1111. <col class="field-body" />
  1112. <tbody valign="top">
  1113. <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.
  1114. The string format is determined by gRPC runtime.</td>
  1115. </tr>
  1116. </tbody>
  1117. </table>
  1118. </dd></dl>
  1119. <dl class="method">
  1120. <dt id="grpc.ServicerContext.peer_identities">
  1121. <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>
  1122. <dd><p>Gets one or more peer identity(s).</p>
  1123. <blockquote>
  1124. <div><p>Equivalent to
  1125. servicer_context.auth_context().get(</p>
  1126. <blockquote>
  1127. <div>servicer_context.peer_identity_key())</div></blockquote>
  1128. </div></blockquote>
  1129. <table class="docutils field-list" frame="void" rules="none">
  1130. <col class="field-name" />
  1131. <col class="field-body" />
  1132. <tbody valign="top">
  1133. <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.
  1134. Each identity is returned as a raw bytes type.</td>
  1135. </tr>
  1136. </tbody>
  1137. </table>
  1138. </dd></dl>
  1139. <dl class="method">
  1140. <dt id="grpc.ServicerContext.peer_identity_key">
  1141. <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>
  1142. <dd><p>The auth property used to identify the peer.</p>
  1143. <p>For example, “x509_common_name” or “x509_subject_alternative_name” are
  1144. used to identify an SSL peer.</p>
  1145. <table class="docutils field-list" frame="void" rules="none">
  1146. <col class="field-name" />
  1147. <col class="field-body" />
  1148. <tbody valign="top">
  1149. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The auth property (string) that indicates the
  1150. peer identity, or None if the call is not authenticated.</td>
  1151. </tr>
  1152. </tbody>
  1153. </table>
  1154. </dd></dl>
  1155. <dl class="method">
  1156. <dt id="grpc.ServicerContext.send_initial_metadata">
  1157. <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>
  1158. <dd><p>Sends the initial metadata value to the client.</p>
  1159. <p>This method need not be called by implementations if they have no
  1160. metadata to add to what the gRPC runtime will transmit.</p>
  1161. <table class="docutils field-list" frame="void" rules="none">
  1162. <col class="field-name" />
  1163. <col class="field-body" />
  1164. <tbody valign="top">
  1165. <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>
  1166. </tr>
  1167. </tbody>
  1168. </table>
  1169. </dd></dl>
  1170. <dl class="method">
  1171. <dt id="grpc.ServicerContext.set_code">
  1172. <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>
  1173. <dd><p>Sets the value to be used as status code upon RPC completion.</p>
  1174. <p>This method need not be called by method implementations if they wish the
  1175. gRPC runtime to determine the status code of the RPC.</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"><strong>code</strong> – A StatusCode object to be sent to the client.</td>
  1181. </tr>
  1182. </tbody>
  1183. </table>
  1184. </dd></dl>
  1185. <dl class="method">
  1186. <dt id="grpc.ServicerContext.set_details">
  1187. <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>
  1188. <dd><p>Sets the value to be used as detail string upon RPC completion.</p>
  1189. <p>This method need not be called by method implementations if they have no
  1190. details to transmit.</p>
  1191. <table class="docutils field-list" frame="void" rules="none">
  1192. <col class="field-name" />
  1193. <col class="field-body" />
  1194. <tbody valign="top">
  1195. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>details</strong> – An arbitrary string to be sent to the client upon completion.</td>
  1196. </tr>
  1197. </tbody>
  1198. </table>
  1199. </dd></dl>
  1200. <dl class="method">
  1201. <dt id="grpc.ServicerContext.set_trailing_metadata">
  1202. <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>
  1203. <dd><p>Sends the trailing metadata for the RPC.</p>
  1204. <p>This method need not be called by implementations if they have no
  1205. metadata to add to what the gRPC runtime will transmit.</p>
  1206. <table class="docutils field-list" frame="void" rules="none">
  1207. <col class="field-name" />
  1208. <col class="field-body" />
  1209. <tbody valign="top">
  1210. <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>
  1211. </tr>
  1212. </tbody>
  1213. </table>
  1214. </dd></dl>
  1215. </dd></dl>
  1216. <dl class="class">
  1217. <dt id="grpc.RpcMethodHandler">
  1218. <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>
  1219. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  1220. <p>An implementation of a single RPC method.</p>
  1221. <dl class="attribute">
  1222. <dt id="grpc.RpcMethodHandler.request_streaming">
  1223. <code class="descname">request_streaming</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_streaming" title="Permalink to this definition">¶</a></dt>
  1224. <dd><p>Whether the RPC supports exactly one request message or
  1225. any arbitrary number of request messages.</p>
  1226. </dd></dl>
  1227. <dl class="attribute">
  1228. <dt id="grpc.RpcMethodHandler.response_streaming">
  1229. <code class="descname">response_streaming</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_streaming" title="Permalink to this definition">¶</a></dt>
  1230. <dd><p>Whether the RPC supports exactly one response message or
  1231. any arbitrary number of response messages.</p>
  1232. </dd></dl>
  1233. <dl class="attribute">
  1234. <dt id="grpc.RpcMethodHandler.request_deserializer">
  1235. <code class="descname">request_deserializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.request_deserializer" title="Permalink to this definition">¶</a></dt>
  1236. <dd><p>A callable behavior that accepts a byte string and
  1237. returns an object suitable to be passed to this object’s business logic,
  1238. or None to indicate that this object’s business logic should be passed the
  1239. raw request bytes.</p>
  1240. </dd></dl>
  1241. <dl class="attribute">
  1242. <dt id="grpc.RpcMethodHandler.response_serializer">
  1243. <code class="descname">response_serializer</code><a class="headerlink" href="#grpc.RpcMethodHandler.response_serializer" title="Permalink to this definition">¶</a></dt>
  1244. <dd><p>A callable behavior that accepts an object produced by
  1245. this object’s business logic and returns a byte string, or None to
  1246. indicate that the byte strings produced by this object’s business logic
  1247. should be transmitted on the wire as they are.</p>
  1248. </dd></dl>
  1249. <dl class="attribute">
  1250. <dt id="grpc.RpcMethodHandler.unary_unary">
  1251. <code class="descname">unary_unary</code><a class="headerlink" href="#grpc.RpcMethodHandler.unary_unary" title="Permalink to this definition">¶</a></dt>
  1252. <dd><p>This object’s application-specific business logic as a callable
  1253. value that takes a request value and a ServicerContext object and returns
  1254. a response value. Only non-None if both request_streaming and
  1255. response_streaming are False.</p>
  1256. </dd></dl>
  1257. <dl class="attribute">
  1258. <dt id="grpc.RpcMethodHandler.unary_stream">
  1259. <code class="descname">unary_stream</code><a class="headerlink" href="#grpc.RpcMethodHandler.unary_stream" title="Permalink to this definition">¶</a></dt>
  1260. <dd><p>This object’s application-specific business logic as a
  1261. callable value that takes a request value and a ServicerContext object and
  1262. returns an iterator of response values. Only non-None if request_streaming
  1263. is False and response_streaming is True.</p>
  1264. </dd></dl>
  1265. <dl class="attribute">
  1266. <dt id="grpc.RpcMethodHandler.stream_unary">
  1267. <code class="descname">stream_unary</code><a class="headerlink" href="#grpc.RpcMethodHandler.stream_unary" title="Permalink to this definition">¶</a></dt>
  1268. <dd><p>This object’s application-specific business logic as a
  1269. callable value that takes an iterator of request values and a
  1270. ServicerContext object and returns a response value. Only non-None if
  1271. request_streaming is True and response_streaming is False.</p>
  1272. </dd></dl>
  1273. <dl class="attribute">
  1274. <dt id="grpc.RpcMethodHandler.stream_stream">
  1275. <code class="descname">stream_stream</code><a class="headerlink" href="#grpc.RpcMethodHandler.stream_stream" title="Permalink to this definition">¶</a></dt>
  1276. <dd><p>This object’s application-specific business logic as a
  1277. callable value that takes an iterator of request values and a
  1278. ServicerContext object and returns an iterator of response values. Only
  1279. non-None if request_streaming and response_streaming are both True.</p>
  1280. </dd></dl>
  1281. </dd></dl>
  1282. <dl class="class">
  1283. <dt id="grpc.HandlerCallDetails">
  1284. <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>
  1285. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  1286. <p>Describes an RPC that has just arrived for service.
  1287. .. attribute:: method</p>
  1288. <blockquote>
  1289. <div>The method name of the RPC.</div></blockquote>
  1290. <dl class="attribute">
  1291. <dt id="grpc.HandlerCallDetails.invocation_metadata">
  1292. <code class="descname">invocation_metadata</code><a class="headerlink" href="#grpc.HandlerCallDetails.invocation_metadata" title="Permalink to this definition">¶</a></dt>
  1293. <dd><p>The <a class="reference internal" href="#term-metadata"><span class="xref std std-term">metadata</span></a> sent by the client.</p>
  1294. </dd></dl>
  1295. </dd></dl>
  1296. <dl class="class">
  1297. <dt id="grpc.GenericRpcHandler">
  1298. <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>
  1299. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  1300. <p>An implementation of arbitrarily many RPC methods.</p>
  1301. <dl class="method">
  1302. <dt id="grpc.GenericRpcHandler.service">
  1303. <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>
  1304. <dd><p>Returns the handler for servicing the RPC.</p>
  1305. <table class="docutils field-list" frame="void" rules="none">
  1306. <col class="field-name" />
  1307. <col class="field-body" />
  1308. <tbody valign="top">
  1309. <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>
  1310. </tr>
  1311. <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
  1312. implementation chooses to service this RPC, or None otherwise.</td>
  1313. </tr>
  1314. </tbody>
  1315. </table>
  1316. </dd></dl>
  1317. </dd></dl>
  1318. <dl class="class">
  1319. <dt id="grpc.ServiceRpcHandler">
  1320. <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>
  1321. <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>
  1322. <p>An implementation of RPC methods belonging to a service.</p>
  1323. <p>A service handles RPC methods with structured names of the form
  1324. ‘/Service.Name/Service.Method’, where ‘Service.Name’ is the value
  1325. returned by service_name(), and ‘Service.Method’ is the method
  1326. name. A service can have multiple method names, but only a single
  1327. service name.</p>
  1328. <dl class="method">
  1329. <dt id="grpc.ServiceRpcHandler.service_name">
  1330. <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>
  1331. <dd><p>Returns this service’s name.</p>
  1332. <table class="docutils field-list" frame="void" rules="none">
  1333. <col class="field-name" />
  1334. <col class="field-body" />
  1335. <tbody valign="top">
  1336. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The service name.</td>
  1337. </tr>
  1338. </tbody>
  1339. </table>
  1340. </dd></dl>
  1341. </dd></dl>
  1342. <dl class="class">
  1343. <dt id="grpc.Server">
  1344. <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>
  1345. <dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
  1346. <p>Services RPCs.</p>
  1347. <dl class="method">
  1348. <dt id="grpc.Server.add_generic_rpc_handlers">
  1349. <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>
  1350. <dd><p>Registers GenericRpcHandlers with this Server.</p>
  1351. <p>This method is only safe to call before the server is started.</p>
  1352. <table class="docutils field-list" frame="void" rules="none">
  1353. <col class="field-name" />
  1354. <col class="field-body" />
  1355. <tbody valign="top">
  1356. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  1357. <li><strong>generic_rpc_handlers</strong> – An iterable of GenericRpcHandlers that will be used</li>
  1358. <li><strong>service RPCs.</strong> (<em>to</em>) – </li>
  1359. </ul>
  1360. </td>
  1361. </tr>
  1362. </tbody>
  1363. </table>
  1364. </dd></dl>
  1365. <dl class="method">
  1366. <dt id="grpc.Server.add_insecure_port">
  1367. <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>
  1368. <dd><p>Opens an insecure port for accepting RPCs.</p>
  1369. <p>This method may only be called before starting the server.</p>
  1370. <table class="docutils field-list" frame="void" rules="none">
  1371. <col class="field-name" />
  1372. <col class="field-body" />
  1373. <tbody valign="top">
  1374. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1375. <li><strong>address</strong> – The address for which to open a port.</li>
  1376. <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>
  1377. <li><strong>choose a port.</strong> (<em>will</em>) – </li>
  1378. </ul>
  1379. </td>
  1380. </tr>
  1381. <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>
  1382. </td>
  1383. </tr>
  1384. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">integer</p>
  1385. </td>
  1386. </tr>
  1387. </tbody>
  1388. </table>
  1389. </dd></dl>
  1390. <dl class="method">
  1391. <dt id="grpc.Server.add_secure_port">
  1392. <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>
  1393. <dd><p>Opens a secure port for accepting RPCs.</p>
  1394. <p>This method may only be called before starting the server.</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"><ul class="first simple">
  1400. <li><strong>address</strong> – The address for which to open a port.
  1401. if the port is 0, or not specified in the address, then gRPC runtime
  1402. will choose a port.</li>
  1403. <li><strong>server_credentials</strong> – A ServerCredentials object.</li>
  1404. </ul>
  1405. </td>
  1406. </tr>
  1407. <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>
  1408. </td>
  1409. </tr>
  1410. <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">integer</p>
  1411. </td>
  1412. </tr>
  1413. </tbody>
  1414. </table>
  1415. </dd></dl>
  1416. <dl class="method">
  1417. <dt id="grpc.Server.start">
  1418. <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>
  1419. <dd><p>Starts this Server.</p>
  1420. <p>This method may only be called once. (i.e. it is not idempotent).</p>
  1421. </dd></dl>
  1422. <dl class="method">
  1423. <dt id="grpc.Server.stop">
  1424. <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>
  1425. <dd><p>Stops this Server.</p>
  1426. <p>This method immediately stop service of new RPCs in all cases.
  1427. If a grace period is specified, this method returns immediately
  1428. and all RPCs active at the end of the grace period are aborted.</p>
  1429. <p>If a grace period is not specified, then all existing RPCs are
  1430. teriminated immediately and the this method blocks until the last
  1431. RPC handler terminates.</p>
  1432. <p>This method is idempotent and may be called at any time. Passing a smaller
  1433. grace value in subsequentcall will have the effect of stopping the Server
  1434. sooner. Passing a larger grace value in subsequent call <em>will not</em> have the
  1435. effect of stopping the server later (i.e. the most restrictive grace
  1436. value is used).</p>
  1437. <table class="docutils field-list" frame="void" rules="none">
  1438. <col class="field-name" />
  1439. <col class="field-body" />
  1440. <tbody valign="top">
  1441. <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>
  1442. </tr>
  1443. <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
  1444. stopped, i.e. when running RPCs either complete or are aborted and
  1445. all handlers have terminated.</td>
  1446. </tr>
  1447. </tbody>
  1448. </table>
  1449. </dd></dl>
  1450. </dd></dl>
  1451. <dl class="function">
  1452. <dt id="grpc.unary_unary_rpc_method_handler">
  1453. <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>
  1454. <dd><p>Creates an RpcMethodHandler for a unary-unary RPC method.</p>
  1455. <table class="docutils field-list" frame="void" rules="none">
  1456. <col class="field-name" />
  1457. <col class="field-body" />
  1458. <tbody valign="top">
  1459. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1460. <li><strong>behavior</strong> – The implementation of an RPC that accepts one request and returns</li>
  1461. <li><strong>response.</strong> (<em>one</em>) – </li>
  1462. <li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li>
  1463. <li><strong>response_serializer</strong> – An optional behavior for response serialization.</li>
  1464. </ul>
  1465. </td>
  1466. </tr>
  1467. <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>
  1468. </td>
  1469. </tr>
  1470. </tbody>
  1471. </table>
  1472. </dd></dl>
  1473. <dl class="function">
  1474. <dt id="grpc.unary_stream_rpc_method_handler">
  1475. <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>
  1476. <dd><p>Creates an RpcMethodHandler for a unary-stream RPC method.</p>
  1477. <table class="docutils field-list" frame="void" rules="none">
  1478. <col class="field-name" />
  1479. <col class="field-body" />
  1480. <tbody valign="top">
  1481. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1482. <li><strong>behavior</strong> – The implementation of an RPC that accepts one request and returns
  1483. an iterator of response values.</li>
  1484. <li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li>
  1485. <li><strong>response_serializer</strong> – An optional behavior for response serialization.</li>
  1486. </ul>
  1487. </td>
  1488. </tr>
  1489. <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>
  1490. </td>
  1491. </tr>
  1492. </tbody>
  1493. </table>
  1494. </dd></dl>
  1495. <dl class="function">
  1496. <dt id="grpc.stream_unary_rpc_method_handler">
  1497. <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>
  1498. <dd><p>Creates an RpcMethodHandler for a stream-unary RPC method.</p>
  1499. <table class="docutils field-list" frame="void" rules="none">
  1500. <col class="field-name" />
  1501. <col class="field-body" />
  1502. <tbody valign="top">
  1503. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1504. <li><strong>behavior</strong> – The implementation of an RPC that accepts an iterator of request</li>
  1505. <li><strong>and returns a single response value.</strong> (<em>values</em>) – </li>
  1506. <li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li>
  1507. <li><strong>response_serializer</strong> – An optional behavior for response serialization.</li>
  1508. </ul>
  1509. </td>
  1510. </tr>
  1511. <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>
  1512. </td>
  1513. </tr>
  1514. </tbody>
  1515. </table>
  1516. </dd></dl>
  1517. <dl class="function">
  1518. <dt id="grpc.stream_stream_rpc_method_handler">
  1519. <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>
  1520. <dd><p>Creates an RpcMethodHandler for a stream-stream RPC method.</p>
  1521. <table class="docutils field-list" frame="void" rules="none">
  1522. <col class="field-name" />
  1523. <col class="field-body" />
  1524. <tbody valign="top">
  1525. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1526. <li><strong>behavior</strong> – The implementation of an RPC that accepts an iterator of request</li>
  1527. <li><strong>and returns an iterator of response values.</strong> (<em>values</em>) – </li>
  1528. <li><strong>request_deserializer</strong> – An optional behavior for request deserialization.</li>
  1529. <li><strong>response_serializer</strong> – An optional behavior for response serialization.</li>
  1530. </ul>
  1531. </td>
  1532. </tr>
  1533. <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>
  1534. </td>
  1535. </tr>
  1536. </tbody>
  1537. </table>
  1538. </dd></dl>
  1539. <dl class="function">
  1540. <dt id="grpc.method_handlers_generic_handler">
  1541. <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>
  1542. <dd><p>Creates a GenericRpcHandler from RpcMethodHandlers.</p>
  1543. <table class="docutils field-list" frame="void" rules="none">
  1544. <col class="field-name" />
  1545. <col class="field-body" />
  1546. <tbody valign="top">
  1547. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1548. <li><strong>service</strong> – The name of the service that is implemented by the method_handlers.</li>
  1549. <li><strong>method_handlers</strong> – A dictionary that maps method names to corresponding</li>
  1550. <li><strong>RpcMethodHandler.</strong> – </li>
  1551. </ul>
  1552. </td>
  1553. </tr>
  1554. <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
  1555. with add_generic_rpc_handlers() before starting the server.</p>
  1556. </td>
  1557. </tr>
  1558. </tbody>
  1559. </table>
  1560. </dd></dl>
  1561. <dl class="function">
  1562. <dt id="grpc.ssl_channel_credentials">
  1563. <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>
  1564. <dd><p>Creates a ChannelCredentials for use with an SSL-enabled Channel.</p>
  1565. <table class="docutils field-list" frame="void" rules="none">
  1566. <col class="field-name" />
  1567. <col class="field-body" />
  1568. <tbody valign="top">
  1569. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1570. <li><strong>root_certificates</strong> – The PEM-encoded root certificates as a byte string,</li>
  1571. <li><strong>None to retrieve them from a default location chosen by gRPC runtime.</strong> (<em>or</em>) – </li>
  1572. <li><strong>private_key</strong> – The PEM-encoded private key as a byte string, or None if no</li>
  1573. <li><strong>key should be used.</strong> (<em>private</em>) – </li>
  1574. <li><strong>certificate_chain</strong> – The PEM-encoded certificate chain as a byte string</li>
  1575. <li><strong>use</strong><strong> or </strong><strong>or None if no certificate chain should be used.</strong> (<em>to</em>) – </li>
  1576. </ul>
  1577. </td>
  1578. </tr>
  1579. <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>
  1580. </td>
  1581. </tr>
  1582. </tbody>
  1583. </table>
  1584. </dd></dl>
  1585. <dl class="function">
  1586. <dt id="grpc.metadata_call_credentials">
  1587. <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>
  1588. <dd><p>Construct CallCredentials from an AuthMetadataPlugin.</p>
  1589. <table class="docutils field-list" frame="void" rules="none">
  1590. <col class="field-name" />
  1591. <col class="field-body" />
  1592. <tbody valign="top">
  1593. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1594. <li><strong>metadata_plugin</strong> – An AuthMetadataPlugin to use for authentication.</li>
  1595. <li><strong>name</strong> – An optional name for the plugin.</li>
  1596. </ul>
  1597. </td>
  1598. </tr>
  1599. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A CallCredentials.</p>
  1600. </td>
  1601. </tr>
  1602. </tbody>
  1603. </table>
  1604. </dd></dl>
  1605. <dl class="function">
  1606. <dt id="grpc.access_token_call_credentials">
  1607. <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>
  1608. <dd><p>Construct CallCredentials from an access token.</p>
  1609. <table class="docutils field-list" frame="void" rules="none">
  1610. <col class="field-name" />
  1611. <col class="field-body" />
  1612. <tbody valign="top">
  1613. <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
  1614. authorization header, for example
  1615. “authorization: Bearer &lt;access_token&gt;”.</td>
  1616. </tr>
  1617. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A CallCredentials.</td>
  1618. </tr>
  1619. </tbody>
  1620. </table>
  1621. </dd></dl>
  1622. <dl class="function">
  1623. <dt id="grpc.composite_call_credentials">
  1624. <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>
  1625. <dd><p>Compose multiple CallCredentials to make a new CallCredentials.</p>
  1626. <table class="docutils field-list" frame="void" rules="none">
  1627. <col class="field-name" />
  1628. <col class="field-body" />
  1629. <tbody valign="top">
  1630. <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>
  1631. </tr>
  1632. <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>
  1633. </tr>
  1634. </tbody>
  1635. </table>
  1636. </dd></dl>
  1637. <dl class="function">
  1638. <dt id="grpc.composite_channel_credentials">
  1639. <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>
  1640. <dd><p>Compose a ChannelCredentials and one or more CallCredentials objects.</p>
  1641. <table class="docutils field-list" frame="void" rules="none">
  1642. <col class="field-name" />
  1643. <col class="field-body" />
  1644. <tbody valign="top">
  1645. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1646. <li><strong>channel_credentials</strong> – A ChannelCredentials object.</li>
  1647. <li><strong>*call_credentials</strong> – One or more CallCredentials objects.</li>
  1648. </ul>
  1649. </td>
  1650. </tr>
  1651. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A ChannelCredentials composed of the given ChannelCredentials and
  1652. CallCredentials objects.</p>
  1653. </td>
  1654. </tr>
  1655. </tbody>
  1656. </table>
  1657. </dd></dl>
  1658. <dl class="function">
  1659. <dt id="grpc.ssl_server_credentials">
  1660. <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>
  1661. <dd><p>Creates a ServerCredentials for use with an SSL-enabled Server.</p>
  1662. <table class="docutils field-list" frame="void" rules="none">
  1663. <col class="field-name" />
  1664. <col class="field-body" />
  1665. <tbody valign="top">
  1666. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1667. <li><strong>private_key_certificate_chain_pairs</strong> – A list of pairs of the form
  1668. [PEM-encoded private key, PEM-encoded certificate chain].</li>
  1669. <li><strong>root_certificates</strong> – An optional byte string of PEM-encoded client root
  1670. certificates that the server will use to verify client authentication.
  1671. If omitted, require_client_auth must also be False.</li>
  1672. <li><strong>require_client_auth</strong> – A boolean indicating whether or not to require
  1673. clients to be authenticated. May only be True if root_certificates
  1674. is not None.</li>
  1675. </ul>
  1676. </td>
  1677. </tr>
  1678. <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
  1679. object is an argument to add_secure_port() method during server setup.</p>
  1680. </td>
  1681. </tr>
  1682. </tbody>
  1683. </table>
  1684. </dd></dl>
  1685. <dl class="function">
  1686. <dt id="grpc.channel_ready_future">
  1687. <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>
  1688. <dd><p>Creates a Future that tracks when a Channel is ready.</p>
  1689. <p>Cancelling the Future does not affect the channel’s state machine.
  1690. It merely decouples the Future from channel state machine.</p>
  1691. <table class="docutils field-list" frame="void" rules="none">
  1692. <col class="field-name" />
  1693. <col class="field-body" />
  1694. <tbody valign="top">
  1695. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>channel</strong> – A Channel object.</td>
  1696. </tr>
  1697. <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
  1698. ChannelConnectivity.READY.</td>
  1699. </tr>
  1700. </tbody>
  1701. </table>
  1702. </dd></dl>
  1703. <dl class="function">
  1704. <dt id="grpc.insecure_channel">
  1705. <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>
  1706. <dd><p>Creates an insecure Channel to a server.</p>
  1707. <table class="docutils field-list" frame="void" rules="none">
  1708. <col class="field-name" />
  1709. <col class="field-body" />
  1710. <tbody valign="top">
  1711. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1712. <li><strong>target</strong> – The server address</li>
  1713. <li><strong>options</strong> – An optional list of key-value pairs (channel args in gRPC runtime)</li>
  1714. <li><strong>configure the channel.</strong> (<em>to</em>) – </li>
  1715. </ul>
  1716. </td>
  1717. </tr>
  1718. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Channel object.</p>
  1719. </td>
  1720. </tr>
  1721. </tbody>
  1722. </table>
  1723. </dd></dl>
  1724. <dl class="function">
  1725. <dt id="grpc.secure_channel">
  1726. <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>
  1727. <dd><p>Creates a secure Channel to a server.</p>
  1728. <table class="docutils field-list" frame="void" rules="none">
  1729. <col class="field-name" />
  1730. <col class="field-body" />
  1731. <tbody valign="top">
  1732. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1733. <li><strong>target</strong> – The server address.</li>
  1734. <li><strong>credentials</strong> – A ChannelCredentials instance.</li>
  1735. <li><strong>options</strong> – An optional list of key-value pairs (channel args in gRPC runtime)</li>
  1736. <li><strong>configure the channel.</strong> (<em>to</em>) – </li>
  1737. </ul>
  1738. </td>
  1739. </tr>
  1740. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Channel object.</p>
  1741. </td>
  1742. </tr>
  1743. </tbody>
  1744. </table>
  1745. </dd></dl>
  1746. <dl class="function">
  1747. <dt id="grpc.server">
  1748. <code class="descclassname">grpc.</code><code class="descname">server</code><span class="sig-paren">(</span><em>thread_pool</em>, <em>handlers=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>
  1749. <dd><p>Creates a Server with which RPCs can be serviced.</p>
  1750. <table class="docutils field-list" frame="void" rules="none">
  1751. <col class="field-name" />
  1752. <col class="field-body" />
  1753. <tbody valign="top">
  1754. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  1755. <li><strong>thread_pool</strong> – A futures.ThreadPoolExecutor to be used by the Server
  1756. to execute RPC handlers.</li>
  1757. <li><strong>handlers</strong> – An optional list of GenericRpcHandlers used for executing RPCs.
  1758. More handlers may be added by calling add_generic_rpc_handlers any time
  1759. before the server is started.</li>
  1760. <li><strong>options</strong> – An optional list of key-value pairs (channel args in gRPC runtime)</li>
  1761. <li><strong>configure the channel.</strong> (<em>to</em>) – </li>
  1762. <li><strong>maximum_concurrent_rpcs</strong> – The maximum number of concurrent RPCs this server
  1763. will service before returning RESOURCE_EXHAUSTED status, or None to
  1764. indicate no limit.</li>
  1765. </ul>
  1766. </td>
  1767. </tr>
  1768. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Server object.</p>
  1769. </td>
  1770. </tr>
  1771. </tbody>
  1772. </table>
  1773. </dd></dl>
  1774. </div>
  1775. </div>
  1776. <div class="section" id="glossary">
  1777. <h1>Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline">¶</a></h1>
  1778. <dl class="glossary docutils">
  1779. <dt id="term-metadatum">metadatum</dt>
  1780. <dd>A key-value pair included in the HTTP header. It is a
  1781. 2-tuple where the first entry is the key and the
  1782. second is the value, i.e. (key, value). The metadata key is an ASCII str,
  1783. and must be a valid HTTP header name. The metadata value can be
  1784. either a valid HTTP ASCII str, or bytes. If bytes are provided,
  1785. the key must end with ‘-bin’, i.e.
  1786. <code class="docutils literal"><span class="pre">('binary-metadata-bin',</span> <span class="pre">b'\x00\xFF')</span></code></dd>
  1787. <dt id="term-metadata">metadata</dt>
  1788. <dd>A sequence of metadatum.</dd>
  1789. </dl>
  1790. </div>
  1791. </div>
  1792. <div class="articleComments">
  1793. </div>
  1794. </div>
  1795. <footer>
  1796. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  1797. <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>
  1798. <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>
  1799. </div>
  1800. <hr/>
  1801. <div role="contentinfo">
  1802. <p>
  1803. &copy; Copyright 2016, The gRPC Authors.
  1804. </p>
  1805. </div>
  1806. 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>.
  1807. </footer>
  1808. </div>
  1809. </div>
  1810. </section>
  1811. </div>
  1812. <script type="text/javascript">
  1813. var DOCUMENTATION_OPTIONS = {
  1814. URL_ROOT:'./',
  1815. VERSION:'1.6.0',
  1816. LANGUAGE:'en',
  1817. COLLAPSE_INDEX:false,
  1818. FILE_SUFFIX:'.html',
  1819. HAS_SOURCE: true,
  1820. SOURCELINK_SUFFIX: '.txt'
  1821. };
  1822. </script>
  1823. <script type="text/javascript" src="_static/jquery.js"></script>
  1824. <script type="text/javascript" src="_static/underscore.js"></script>
  1825. <script type="text/javascript" src="_static/doctools.js"></script>
  1826. <script type="text/javascript" src="_static/js/theme.js"></script>
  1827. <script type="text/javascript">
  1828. jQuery(function () {
  1829. SphinxRtdTheme.StickyNav.enable();
  1830. });
  1831. </script>
  1832. </body>
  1833. </html>