OLD | NEW |
(Empty) | |
| 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>apiclient.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 |
| 18 <!-- Tree link --> |
| 19 <th> <a |
| 20 href="module-tree.html">Trees</a> </th> |
| 21 |
| 22 <!-- Index link --> |
| 23 <th> <a |
| 24 href="identifier-index.html">Indices</a> </th> |
| 25 |
| 26 <!-- Help link --> |
| 27 <th> <a |
| 28 href="help.html">Help</a> </th> |
| 29 |
| 30 <th class="navbar" width="100%"></th> |
| 31 </tr> |
| 32 </table> |
| 33 <table width="100%" cellpadding="0" cellspacing="0"> |
| 34 <tr valign="top"> |
| 35 <td width="100%"> |
| 36 <span class="breadcrumbs"> |
| 37 <a href="apiclient-module.html">Package apiclient</a> :: |
| 38 <a href="apiclient.http-module.html">Module http</a> :: |
| 39 Class HttpMockSequence |
| 40 </span> |
| 41 </td> |
| 42 <td> |
| 43 <table cellpadding="0" cellspacing="0"> |
| 44 <!-- hide/show private --> |
| 45 <tr><td align="right"><span class="options">[<a href="javascript:void(0)
;" class="privatelink" |
| 46 onclick="toggle_private();">hide private</a>]</span></td></tr> |
| 47 <tr><td align="right"><span class="options" |
| 48 >[<a href="frames.html" target="_top">frames</a |
| 49 >] | <a href="apiclient.http.HttpMockSequence-class.html" |
| 50 target="_top">no frames</a>]</span></td></tr> |
| 51 </table> |
| 52 </td> |
| 53 </tr> |
| 54 </table> |
| 55 <!-- ==================== CLASS DESCRIPTION ==================== --> |
| 56 <h1 class="epydoc">Class HttpMockSequence</h1><p class="nomargin-top"><span clas
s="codelink"><a href="apiclient.http-pysrc.html#HttpMockSequence">source co
de</a></span></p> |
| 57 <center> |
| 58 <center> <map id="uml_class_diagram_for_apiclien_14" name="uml_class_diagram_fo
r_apiclien_14"> |
| 59 <area shape="rect" href="apiclient.http.HttpMockSequence-class.html#__init__" ti
tle="Args:..." alt="" coords="17,36,601,55"/> |
| 60 <area shape="rect" href="apiclient.http.HttpMockSequence-class.html#request" tit
le="apiclient.http.HttpMockSequence.request" alt="" coords="17,55,601,73"/> |
| 61 <area shape="rect" href="apiclient.http.HttpMockSequence-class.html" title="Mock
of httplib2.Http" alt="" coords="16,11,603,75"/> |
| 62 </map> |
| 63 <img src="uml_class_diagram_for_apiclien_14.gif" alt='' usemap="#uml_class_dia
gram_for_apiclien_14" ismap="ismap" class="graph-without-title" /> |
| 64 </center> |
| 65 </center> |
| 66 <hr /> |
| 67 <pre class="literalblock"> |
| 68 Mock of httplib2.Http |
| 69 |
| 70 Mocks a sequence of calls to request returning different responses for each |
| 71 call. Create an instance initialized with the desired response headers |
| 72 and content and then use as if an httplib2.Http instance. |
| 73 |
| 74 http = HttpMockSequence([ |
| 75 ({'status': '401'}, ''), |
| 76 ({'status': '200'}, '{"access_token":"1/3w","expire
s_in":3600}'), |
| 77 ({'status': '200'}, 'echo_request_headers'), |
| 78 ]) |
| 79 resp, content = http.request("http://examples.com") |
| 80 |
| 81 There are special values you can pass in for content to trigger |
| 82 behavours that are helpful in testing. |
| 83 |
| 84 'echo_request_headers' means return the request headers in the response body |
| 85 'echo_request_headers_as_json' means return the request headers in |
| 86 the response body |
| 87 'echo_request_body' means return the request body in the response body |
| 88 'echo_request_uri' means return the request uri in the response body |
| 89 |
| 90 </pre> |
| 91 |
| 92 <!-- ==================== INSTANCE METHODS ==================== --> |
| 93 <a name="section-InstanceMethods"></a> |
| 94 <table class="summary" border="1" cellpadding="3" |
| 95 cellspacing="0" width="100%" bgcolor="white"> |
| 96 <tr bgcolor="#70b0f0" class="table-header"> |
| 97 <td colspan="2" class="table-header"> |
| 98 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 99 <tr valign="top"> |
| 100 <td align="left"><span class="table-header">Instance Methods</span></td> |
| 101 <td align="right" valign="top" |
| 102 ><span class="options">[<a href="#section-InstanceMethods" |
| 103 class="privatelink" onclick="toggle_private();" |
| 104 >hide private</a>]</span></td> |
| 105 </tr> |
| 106 </table> |
| 107 </td> |
| 108 </tr> |
| 109 <tr> |
| 110 <td width="15%" align="right" valign="top" class="summary"> |
| 111 <span class="summary-type"> </span> |
| 112 </td><td class="summary"> |
| 113 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 114 <tr> |
| 115 <td><span class="summary-sig"><a href="apiclient.http.HttpMockSequence
-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary
-sig-arg">self</span>, |
| 116 <span class="summary-sig-arg">iterable</span>)</span><br /> |
| 117 Args:...</td> |
| 118 <td align="right" valign="top"> |
| 119 <span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSe
quence.__init__">source code</a></span> |
| 120 ············ |
| 121 </td> |
| 122 </tr> |
| 123 </table> |
| 124 ······ |
| 125 </td> |
| 126 </tr> |
| 127 <tr> |
| 128 <td width="15%" align="right" valign="top" class="summary"> |
| 129 <span class="summary-type"> </span> |
| 130 </td><td class="summary"> |
| 131 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 132 <tr> |
| 133 <td><span class="summary-sig"><a name="request"></a><span class="summa
ry-sig-name">request</span>(<span class="summary-sig-arg">self</span>, |
| 134 <span class="summary-sig-arg">uri</span>, |
| 135 <span class="summary-sig-arg">method</span>=<span class="summary-sig-def
ault"><code class="variable-quote">'</code><code class="variable-string">GET</co
de><code class="variable-quote">'</code></span>, |
| 136 <span class="summary-sig-arg">body</span>=<span class="summary-sig-defau
lt">None</span>, |
| 137 <span class="summary-sig-arg">headers</span>=<span class="summary-sig-de
fault">None</span>, |
| 138 <span class="summary-sig-arg">redirections</span>=<span class="summary-s
ig-default">1</span>, |
| 139 <span class="summary-sig-arg">connection_type</span>=<span class="summar
y-sig-default">None</span>)</span></td> |
| 140 <td align="right" valign="top"> |
| 141 <span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSe
quence.request">source code</a></span> |
| 142 ············ |
| 143 </td> |
| 144 </tr> |
| 145 </table> |
| 146 ······ |
| 147 </td> |
| 148 </tr> |
| 149 <tr> |
| 150 <td colspan="2" class="summary"> |
| 151 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 152 <code>__delattr__</code>, |
| 153 <code>__format__</code>, |
| 154 <code>__getattribute__</code>, |
| 155 <code>__hash__</code>, |
| 156 <code>__new__</code>, |
| 157 <code>__reduce__</code>, |
| 158 <code>__reduce_ex__</code>, |
| 159 <code>__repr__</code>, |
| 160 <code>__setattr__</code>, |
| 161 <code>__sizeof__</code>, |
| 162 <code>__str__</code>, |
| 163 <code>__subclasshook__</code> |
| 164 </p> |
| 165 </td> |
| 166 </tr> |
| 167 </table> |
| 168 <!-- ==================== PROPERTIES ==================== --> |
| 169 <a name="section-Properties"></a> |
| 170 <table class="summary" border="1" cellpadding="3" |
| 171 cellspacing="0" width="100%" bgcolor="white"> |
| 172 <tr bgcolor="#70b0f0" class="table-header"> |
| 173 <td colspan="2" class="table-header"> |
| 174 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 175 <tr valign="top"> |
| 176 <td align="left"><span class="table-header">Properties</span></td> |
| 177 <td align="right" valign="top" |
| 178 ><span class="options">[<a href="#section-Properties" |
| 179 class="privatelink" onclick="toggle_private();" |
| 180 >hide private</a>]</span></td> |
| 181 </tr> |
| 182 </table> |
| 183 </td> |
| 184 </tr> |
| 185 <tr> |
| 186 <td colspan="2" class="summary"> |
| 187 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 188 <code>__class__</code> |
| 189 </p> |
| 190 </td> |
| 191 </tr> |
| 192 </table> |
| 193 <!-- ==================== METHOD DETAILS ==================== --> |
| 194 <a name="section-MethodDetails"></a> |
| 195 <table class="details" border="1" cellpadding="3" |
| 196 cellspacing="0" width="100%" bgcolor="white"> |
| 197 <tr bgcolor="#70b0f0" class="table-header"> |
| 198 <td colspan="2" class="table-header"> |
| 199 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 200 <tr valign="top"> |
| 201 <td align="left"><span class="table-header">Method Details</span></td> |
| 202 <td align="right" valign="top" |
| 203 ><span class="options">[<a href="#section-MethodDetails" |
| 204 class="privatelink" onclick="toggle_private();" |
| 205 >hide private</a>]</span></td> |
| 206 </tr> |
| 207 </table> |
| 208 </td> |
| 209 </tr> |
| 210 </table> |
| 211 <a name="__init__"></a> |
| 212 <div> |
| 213 <table class="details" border="1" cellpadding="3" |
| 214 cellspacing="0" width="100%" bgcolor="white"> |
| 215 <tr><td> |
| 216 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 217 <tr valign="top"><td> |
| 218 <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<s
pan class="sig-arg">self</span>, |
| 219 <span class="sig-arg">iterable</span>)</span> |
| 220 <br /><em class="fname">(Constructor)</em> |
| 221 </h3> |
| 222 </td><td align="right" valign="top" |
| 223 ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSequence.
__init__">source code</a></span> |
| 224 </td> |
| 225 </tr></table> |
| 226 ·· |
| 227 <pre class="literalblock"> |
| 228 |
| 229 Args: |
| 230 iterable: iterable, a sequence of pairs of (headers, body) |
| 231 |
| 232 </pre> |
| 233 <dl class="fields"> |
| 234 <dt>Overrides: |
| 235 object.__init__ |
| 236 </dt> |
| 237 </dl> |
| 238 </td></tr></table> |
| 239 </div> |
| 240 <br /> |
| 241 <!-- ==================== NAVIGATION BAR ==================== --> |
| 242 <table class="navbar" border="0" width="100%" cellpadding="0" |
| 243 bgcolor="#a0c0ff" cellspacing="0"> |
| 244 <tr valign="middle"> |
| 245 |
| 246 <!-- Tree link --> |
| 247 <th> <a |
| 248 href="module-tree.html">Trees</a> </th> |
| 249 |
| 250 <!-- Index link --> |
| 251 <th> <a |
| 252 href="identifier-index.html">Indices</a> </th> |
| 253 |
| 254 <!-- Help link --> |
| 255 <th> <a |
| 256 href="help.html">Help</a> </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 Tue Jun 5 09:03:06 2012 |
| 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> |
OLD | NEW |