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.HttpRequestMock</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> <a 19 href="googleapiclient-module.html">Home</a> </th> 20 21 <!-- Tree link --> 22 <th> <a 23 href="module-tree.html">Trees</a> </th> 24 25 <!-- Index link --> 26 <th> <a 27 href="identifier-index.html">Indices</a> </th> 28 29 <!-- Help link --> 30 <th> <a 31 href="help.html">Help</a> </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 googleapiclient</a> :: 41 <a href="googleapiclient.http-module.html">Module http</a> :: 42 Class HttpRequestMock 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 private</a>]</span></td></tr> 50 <tr><td align="right"><span class="options" 51 >[<a href="frames.html" target="_top">frames</a 52 >] | <a href="googleapiclient.http.HttpRequestMock-class.html" 53 target="_top">no frames</a>]</span></td></tr> 54 </table> 55 </td> 56 </tr> 57</table> 58<!-- ==================== CLASS DESCRIPTION ==================== --> 59<h1 class="epydoc">Class HttpRequestMock</h1><p class="nomargin-top"><span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpRequestMock">source code</a></span></p> 60<center> 61<center> <map id="uml_class_diagram_for_googleap_28" name="uml_class_diagram_for_googleap_28"> 62<area shape="rect" id="node1_2" href="googleapiclient.http.HttpRequestMock-class.html#__init__" title="Constructor for HttpRequestMock" alt="" coords="18,38,241,58"/> 63<area shape="rect" id="node1_3" href="googleapiclient.http.HttpRequestMock-class.html#execute" title="Execute the request." alt="" coords="18,58,241,78"/> 64<area shape="rect" id="node1" href="googleapiclient.http.HttpRequestMock-class.html" title="Mock of HttpRequest." alt="" coords="5,5,252,84"/> 65</map> 66 <img src="uml_class_diagram_for_googleap_28.gif" alt='' usemap="#uml_class_diagram_for_googleap_28" ismap="ismap" class="graph-without-title" /> 67</center> 68</center> 69<hr /> 70<pre class="literalblock"> 71Mock of HttpRequest. 72 73Do not construct directly, instead use RequestMockBuilder. 74 75</pre> 76 77<!-- ==================== INSTANCE METHODS ==================== --> 78<a name="section-InstanceMethods"></a> 79<table class="summary" border="1" cellpadding="3" 80 cellspacing="0" width="100%" bgcolor="white"> 81<tr bgcolor="#70b0f0" class="table-header"> 82 <td colspan="2" class="table-header"> 83 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 84 <tr valign="top"> 85 <td align="left"><span class="table-header">Instance Methods</span></td> 86 <td align="right" valign="top" 87 ><span class="options">[<a href="#section-InstanceMethods" 88 class="privatelink" onclick="toggle_private();" 89 >hide private</a>]</span></td> 90 </tr> 91 </table> 92 </td> 93</tr> 94<tr> 95 <td width="15%" align="right" valign="top" class="summary"> 96 <span class="summary-type"> </span> 97 </td><td class="summary"> 98 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 99 <tr> 100 <td><span class="summary-sig"><a href="googleapiclient.http.HttpRequestMock-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, 101 <span class="summary-sig-arg">resp</span>, 102 <span class="summary-sig-arg">content</span>, 103 <span class="summary-sig-arg">postproc</span>)</span><br /> 104 Constructor for HttpRequestMock</td> 105 <td align="right" valign="top"> 106 <span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpRequestMock.__init__">source code</a></span> 107 108 </td> 109 </tr> 110 </table> 111 112 </td> 113 </tr> 114<tr> 115 <td width="15%" align="right" valign="top" class="summary"> 116 <span class="summary-type"> </span> 117 </td><td class="summary"> 118 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 119 <tr> 120 <td><span class="summary-sig"><a href="googleapiclient.http.HttpRequestMock-class.html#execute" class="summary-sig-name">execute</a>(<span class="summary-sig-arg">self</span>, 121 <span class="summary-sig-arg">http</span>=<span class="summary-sig-default">None</span>)</span><br /> 122 Execute the request.</td> 123 <td align="right" valign="top"> 124 <span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpRequestMock.execute">source code</a></span> 125 126 </td> 127 </tr> 128 </table> 129 130 </td> 131 </tr> 132 <tr> 133 <td colspan="2" class="summary"> 134 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: 135 <code>__delattr__</code>, 136 <code>__format__</code>, 137 <code>__getattribute__</code>, 138 <code>__hash__</code>, 139 <code>__new__</code>, 140 <code>__reduce__</code>, 141 <code>__reduce_ex__</code>, 142 <code>__repr__</code>, 143 <code>__setattr__</code>, 144 <code>__sizeof__</code>, 145 <code>__str__</code>, 146 <code>__subclasshook__</code> 147 </p> 148 </td> 149 </tr> 150</table> 151<!-- ==================== PROPERTIES ==================== --> 152<a name="section-Properties"></a> 153<table class="summary" border="1" cellpadding="3" 154 cellspacing="0" width="100%" bgcolor="white"> 155<tr bgcolor="#70b0f0" class="table-header"> 156 <td colspan="2" class="table-header"> 157 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 158 <tr valign="top"> 159 <td align="left"><span class="table-header">Properties</span></td> 160 <td align="right" valign="top" 161 ><span class="options">[<a href="#section-Properties" 162 class="privatelink" onclick="toggle_private();" 163 >hide private</a>]</span></td> 164 </tr> 165 </table> 166 </td> 167</tr> 168 <tr> 169 <td colspan="2" class="summary"> 170 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: 171 <code>__class__</code> 172 </p> 173 </td> 174 </tr> 175</table> 176<!-- ==================== METHOD DETAILS ==================== --> 177<a name="section-MethodDetails"></a> 178<table class="details" border="1" cellpadding="3" 179 cellspacing="0" width="100%" bgcolor="white"> 180<tr bgcolor="#70b0f0" class="table-header"> 181 <td colspan="2" class="table-header"> 182 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 183 <tr valign="top"> 184 <td align="left"><span class="table-header">Method Details</span></td> 185 <td align="right" valign="top" 186 ><span class="options">[<a href="#section-MethodDetails" 187 class="privatelink" onclick="toggle_private();" 188 >hide private</a>]</span></td> 189 </tr> 190 </table> 191 </td> 192</tr> 193</table> 194<a name="__init__"></a> 195<div> 196<table class="details" border="1" cellpadding="3" 197 cellspacing="0" width="100%" bgcolor="white"> 198<tr><td> 199 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 200 <tr valign="top"><td> 201 <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, 202 <span class="sig-arg">resp</span>, 203 <span class="sig-arg">content</span>, 204 <span class="sig-arg">postproc</span>)</span> 205 <br /><em class="fname">(Constructor)</em> 206 </h3> 207 </td><td align="right" valign="top" 208 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpRequestMock.__init__">source code</a></span> 209 </td> 210 </tr></table> 211 212 <pre class="literalblock"> 213Constructor for HttpRequestMock 214 215Args: 216 resp: httplib2.Response, the response to emulate coming from the request 217 content: string, the response body 218 postproc: callable, the post processing function usually supplied by 219 the model class. See model.JsonModel.response() as an example. 220 221</pre> 222 <dl class="fields"> 223 <dt>Overrides: 224 object.__init__ 225 </dt> 226 </dl> 227</td></tr></table> 228</div> 229<a name="execute"></a> 230<div> 231<table class="details" border="1" cellpadding="3" 232 cellspacing="0" width="100%" bgcolor="white"> 233<tr><td> 234 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 235 <tr valign="top"><td> 236 <h3 class="epydoc"><span class="sig"><span class="sig-name">execute</span>(<span class="sig-arg">self</span>, 237 <span class="sig-arg">http</span>=<span class="sig-default">None</span>)</span> 238 </h3> 239 </td><td align="right" valign="top" 240 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#HttpRequestMock.execute">source code</a></span> 241 </td> 242 </tr></table> 243 244 <pre class="literalblock"> 245Execute the request. 246 247Same behavior as HttpRequest.execute(), but the response is 248mocked and not really from an HTTP request/response. 249 250</pre> 251 <dl class="fields"> 252 </dl> 253</td></tr></table> 254</div> 255<br /> 256<!-- ==================== NAVIGATION BAR ==================== --> 257<table class="navbar" border="0" width="100%" cellpadding="0" 258 bgcolor="#a0c0ff" cellspacing="0"> 259 <tr valign="middle"> 260 <!-- Home link --> 261 <th> <a 262 href="googleapiclient-module.html">Home</a> </th> 263 264 <!-- Tree link --> 265 <th> <a 266 href="module-tree.html">Trees</a> </th> 267 268 <!-- Index link --> 269 <th> <a 270 href="identifier-index.html">Indices</a> </th> 271 272 <!-- Help link --> 273 <th> <a 274 href="help.html">Help</a> </th> 275 276 <th class="navbar" width="100%"></th> 277 </tr> 278</table> 279<table border="0" cellpadding="0" cellspacing="0" width="100%%"> 280 <tr> 281 <td align="left" class="footer"> 282 Generated by Epydoc 3.0.1 on Fri Jun 14 15:57:28 2019 283 </td> 284 <td align="right" class="footer"> 285 <a target="mainFrame" href="http://epydoc.sourceforge.net" 286 >http://epydoc.sourceforge.net</a> 287 </td> 288 </tr> 289</table> 290 291<script type="text/javascript"> 292 <!-- 293 // Private objects are initially displayed (because if 294 // javascript is turned off then we want them to be 295 // visible); but by default, we want to hide them. So hide 296 // them unless we have a cookie that says to show them. 297 checkCookie(); 298 // --> 299</script> 300</body> 301</html> 302