• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="ascii"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3          "DTD/xhtml1-transitional.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6  <title>googleapiclient.http.HttpMockSequence</title>
7  <link rel="stylesheet" href="epydoc.css" type="text/css" />
8  <script type="text/javascript" src="epydoc.js"></script>
9</head>
10
11<body bgcolor="white" text="black" link="blue" vlink="#204080"
12      alink="#204080">
13<!-- ==================== NAVIGATION BAR ==================== -->
14<table class="navbar" border="0" width="100%" cellpadding="0"
15       bgcolor="#a0c0ff" cellspacing="0">
16  <tr valign="middle">
17  <!-- Home link -->
18      <th>&nbsp;&nbsp;&nbsp;<a
19        href="googleapiclient-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
20
21  <!-- Tree link -->
22      <th>&nbsp;&nbsp;&nbsp;<a
23        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
24
25  <!-- Index link -->
26      <th>&nbsp;&nbsp;&nbsp;<a
27        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
28
29  <!-- Help link -->
30      <th>&nbsp;&nbsp;&nbsp;<a
31        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
32
33      <th class="navbar" width="100%"></th>
34  </tr>
35</table>
36<table width="100%" cellpadding="0" cellspacing="0">
37  <tr valign="top">
38    <td width="100%">
39      <span class="breadcrumbs">
40        <a href="googleapiclient-module.html">Package&nbsp;googleapiclient</a> ::
41        <a href="googleapiclient.http-module.html">Module&nbsp;http</a> ::
42        Class&nbsp;HttpMockSequence
43      </span>
44    </td>
45    <td>
46      <table cellpadding="0" cellspacing="0">
47        <!-- hide/show private -->
48        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
49    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
50        <tr><td align="right"><span class="options"
51            >[<a href="frames.html" target="_top">frames</a
52            >]&nbsp;|&nbsp;<a href="googleapiclient.http.HttpMockSequence-class.html"
53            target="_top">no&nbsp;frames</a>]</span></td></tr>
54      </table>
55    </td>
56  </tr>
57</table>
58<!-- ==================== CLASS DESCRIPTION ==================== -->
59<h1 class="epydoc">Class HttpMockSequence</h1><p class="nomargin-top"><span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpMockSequence">source&nbsp;code</a></span></p>
60<center>
61
62</center>
63<hr />
64<pre class="literalblock">
65Mock of httplib2.Http
66
67Mocks a sequence of calls to request returning different responses for each
68call. Create an instance initialized with the desired response headers
69and content and then use as if an httplib2.Http instance.
70
71  http = HttpMockSequence([
72    ({'status': '401'}, ''),
73    ({'status': '200'}, '{&quot;access_token&quot;:&quot;1/3w&quot;,&quot;expires_in&quot;:3600}'),
74    ({'status': '200'}, 'echo_request_headers'),
75    ])
76  resp, content = http.request(&quot;http://examples.com&quot;)
77
78There are special values you can pass in for content to trigger
79behavours that are helpful in testing.
80
81'echo_request_headers' means return the request headers in the response body
82'echo_request_headers_as_json' means return the request headers in
83   the response body
84'echo_request_body' means return the request body in the response body
85'echo_request_uri' means return the request uri in the response body
86
87</pre>
88
89<!-- ==================== INSTANCE METHODS ==================== -->
90<a name="section-InstanceMethods"></a>
91<table class="summary" border="1" cellpadding="3"
92       cellspacing="0" width="100%" bgcolor="white">
93<tr bgcolor="#70b0f0" class="table-header">
94  <td colspan="2" class="table-header">
95    <table border="0" cellpadding="0" cellspacing="0" width="100%">
96      <tr valign="top">
97        <td align="left"><span class="table-header">Instance Methods</span></td>
98        <td align="right" valign="top"
99         ><span class="options">[<a href="#section-InstanceMethods"
100         class="privatelink" onclick="toggle_private();"
101         >hide private</a>]</span></td>
102      </tr>
103    </table>
104  </td>
105</tr>
106<tr>
107    <td width="15%" align="right" valign="top" class="summary">
108      <span class="summary-type">&nbsp;</span>
109    </td><td class="summary">
110      <table width="100%" cellpadding="0" cellspacing="0" border="0">
111        <tr>
112          <td><span class="summary-sig"><a href="googleapiclient.http.HttpMockSequence-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
113        <span class="summary-sig-arg">iterable</span>)</span><br />
114      Args:...</td>
115          <td align="right" valign="top">
116            <span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpMockSequence.__init__">source&nbsp;code</a></span>
117
118          </td>
119        </tr>
120      </table>
121
122    </td>
123  </tr>
124<tr>
125    <td width="15%" align="right" valign="top" class="summary">
126      <span class="summary-type">&nbsp;</span>
127    </td><td class="summary">
128      <table width="100%" cellpadding="0" cellspacing="0" border="0">
129        <tr>
130          <td><span class="summary-sig"><a name="request"></a><span class="summary-sig-name">request</span>(<span class="summary-sig-arg">self</span>,
131        <span class="summary-sig-arg">uri</span>,
132        <span class="summary-sig-arg">method</span>=<span class="summary-sig-default">'GET'</span>,
133        <span class="summary-sig-arg">body</span>=<span class="summary-sig-default">None</span>,
134        <span class="summary-sig-arg">headers</span>=<span class="summary-sig-default">None</span>,
135        <span class="summary-sig-arg">redirections</span>=<span class="summary-sig-default">1</span>,
136        <span class="summary-sig-arg">connection_type</span>=<span class="summary-sig-default">None</span>)</span></td>
137          <td align="right" valign="top">
138            <span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpMockSequence.request">source&nbsp;code</a></span>
139
140          </td>
141        </tr>
142      </table>
143
144    </td>
145  </tr>
146  <tr>
147    <td colspan="2" class="summary">
148    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
149      <code>__delattr__</code>,
150      <code>__format__</code>,
151      <code>__getattribute__</code>,
152      <code>__hash__</code>,
153      <code>__new__</code>,
154      <code>__reduce__</code>,
155      <code>__reduce_ex__</code>,
156      <code>__repr__</code>,
157      <code>__setattr__</code>,
158      <code>__sizeof__</code>,
159      <code>__str__</code>,
160      <code>__subclasshook__</code>
161      </p>
162    </td>
163  </tr>
164</table>
165<!-- ==================== PROPERTIES ==================== -->
166<a name="section-Properties"></a>
167<table class="summary" border="1" cellpadding="3"
168       cellspacing="0" width="100%" bgcolor="white">
169<tr bgcolor="#70b0f0" class="table-header">
170  <td colspan="2" class="table-header">
171    <table border="0" cellpadding="0" cellspacing="0" width="100%">
172      <tr valign="top">
173        <td align="left"><span class="table-header">Properties</span></td>
174        <td align="right" valign="top"
175         ><span class="options">[<a href="#section-Properties"
176         class="privatelink" onclick="toggle_private();"
177         >hide private</a>]</span></td>
178      </tr>
179    </table>
180  </td>
181</tr>
182  <tr>
183    <td colspan="2" class="summary">
184    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
185      <code>__class__</code>
186      </p>
187    </td>
188  </tr>
189</table>
190<!-- ==================== METHOD DETAILS ==================== -->
191<a name="section-MethodDetails"></a>
192<table class="details" border="1" cellpadding="3"
193       cellspacing="0" width="100%" bgcolor="white">
194<tr bgcolor="#70b0f0" class="table-header">
195  <td colspan="2" class="table-header">
196    <table border="0" cellpadding="0" cellspacing="0" width="100%">
197      <tr valign="top">
198        <td align="left"><span class="table-header">Method Details</span></td>
199        <td align="right" valign="top"
200         ><span class="options">[<a href="#section-MethodDetails"
201         class="privatelink" onclick="toggle_private();"
202         >hide private</a>]</span></td>
203      </tr>
204    </table>
205  </td>
206</tr>
207</table>
208<a name="__init__"></a>
209<div>
210<table class="details" border="1" cellpadding="3"
211       cellspacing="0" width="100%" bgcolor="white">
212<tr><td>
213  <table width="100%" cellpadding="0" cellspacing="0" border="0">
214  <tr valign="top"><td>
215  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
216        <span class="sig-arg">iterable</span>)</span>
217    <br /><em class="fname">(Constructor)</em>
218  </h3>
219  </td><td align="right" valign="top"
220    ><span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpMockSequence.__init__">source&nbsp;code</a></span>&nbsp;
221    </td>
222  </tr></table>
223
224  <pre class="literalblock">
225
226Args:
227  iterable: iterable, a sequence of pairs of (headers, body)
228
229</pre>
230  <dl class="fields">
231    <dt>Overrides:
232        object.__init__
233    </dt>
234  </dl>
235</td></tr></table>
236</div>
237<br />
238<!-- ==================== NAVIGATION BAR ==================== -->
239<table class="navbar" border="0" width="100%" cellpadding="0"
240       bgcolor="#a0c0ff" cellspacing="0">
241  <tr valign="middle">
242  <!-- Home link -->
243      <th>&nbsp;&nbsp;&nbsp;<a
244        href="googleapiclient-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
245
246  <!-- Tree link -->
247      <th>&nbsp;&nbsp;&nbsp;<a
248        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
249
250  <!-- Index link -->
251      <th>&nbsp;&nbsp;&nbsp;<a
252        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
253
254  <!-- Help link -->
255      <th>&nbsp;&nbsp;&nbsp;<a
256        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
257
258      <th class="navbar" width="100%"></th>
259  </tr>
260</table>
261<table border="0" cellpadding="0" cellspacing="0" width="100%%">
262  <tr>
263    <td align="left" class="footer">
264    Generated by Epydoc 3.0.1 on Mon Jun  5 13:38:40 2017
265    </td>
266    <td align="right" class="footer">
267      <a target="mainFrame" href="http://epydoc.sourceforge.net"
268        >http://epydoc.sourceforge.net</a>
269    </td>
270  </tr>
271</table>
272
273<script type="text/javascript">
274  <!--
275  // Private objects are initially displayed (because if
276  // javascript is turned off then we want them to be
277  // visible); but by default, we want to hide them.  So hide
278  // them unless we have a cookie that says to show them.
279  checkCookie();
280  // -->
281</script>
282</body>
283</html>
284