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._StreamSlice</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 _StreamSlice 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._StreamSlice-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 _StreamSlice</h1><p class="nomargin-top"><span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice">source code</a></span></p> 60 <center> 61 62 </center> 63 <hr /> 64 <pre class="literalblock"> 65 Truncated stream. 66 67 Takes a stream and presents a stream that is a slice of the original stream. 68 This is used when uploading media in chunks. In later versions of Python a 69 stream can be passed to httplib in place of the string of data to send. The 70 problem is that httplib just blindly reads to the end of the stream. This 71 wrapper presents a virtual stream that only reads to the end of the chunk. 72 73 </pre> 74 75 <!-- ==================== INSTANCE METHODS ==================== --> 76 <a name="section-InstanceMethods"></a> 77 <table class="summary" border="1" cellpadding="3" 78 cellspacing="0" width="100%" bgcolor="white"> 79 <tr bgcolor="#70b0f0" class="table-header"> 80 <td colspan="2" class="table-header"> 81 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 82 <tr valign="top"> 83 <td align="left"><span class="table-header">Instance Methods</span></td> 84 <td align="right" valign="top" 85 ><span class="options">[<a href="#section-InstanceMethods" 86 class="privatelink" onclick="toggle_private();" 87 >hide private</a>]</span></td> 88 </tr> 89 </table> 90 </td> 91 </tr> 92 <tr> 93 <td width="15%" align="right" valign="top" class="summary"> 94 <span class="summary-type"> </span> 95 </td><td class="summary"> 96 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 97 <tr> 98 <td><span class="summary-sig"><a href="googleapiclient.http._StreamSlice-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, 99 <span class="summary-sig-arg">stream</span>, 100 <span class="summary-sig-arg">begin</span>, 101 <span class="summary-sig-arg">chunksize</span>)</span><br /> 102 Constructor.</td> 103 <td align="right" valign="top"> 104 <span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.__init__">source code</a></span> 105 106 </td> 107 </tr> 108 </table> 109 110 </td> 111 </tr> 112 <tr> 113 <td width="15%" align="right" valign="top" class="summary"> 114 <span class="summary-type"> </span> 115 </td><td class="summary"> 116 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 117 <tr> 118 <td><span class="summary-sig"><a href="googleapiclient.http._StreamSlice-class.html#read" class="summary-sig-name">read</a>(<span class="summary-sig-arg">self</span>, 119 <span class="summary-sig-arg">n</span>=<span class="summary-sig-default">-1</span>)</span><br /> 120 Read n bytes.</td> 121 <td align="right" valign="top"> 122 <span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.read">source code</a></span> 123 124 </td> 125 </tr> 126 </table> 127 128 </td> 129 </tr> 130 <tr> 131 <td colspan="2" class="summary"> 132 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: 133 <code>__delattr__</code>, 134 <code>__format__</code>, 135 <code>__getattribute__</code>, 136 <code>__hash__</code>, 137 <code>__new__</code>, 138 <code>__reduce__</code>, 139 <code>__reduce_ex__</code>, 140 <code>__repr__</code>, 141 <code>__setattr__</code>, 142 <code>__sizeof__</code>, 143 <code>__str__</code>, 144 <code>__subclasshook__</code> 145 </p> 146 </td> 147 </tr> 148 </table> 149 <!-- ==================== PROPERTIES ==================== --> 150 <a name="section-Properties"></a> 151 <table class="summary" border="1" cellpadding="3" 152 cellspacing="0" width="100%" bgcolor="white"> 153 <tr bgcolor="#70b0f0" class="table-header"> 154 <td colspan="2" class="table-header"> 155 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 156 <tr valign="top"> 157 <td align="left"><span class="table-header">Properties</span></td> 158 <td align="right" valign="top" 159 ><span class="options">[<a href="#section-Properties" 160 class="privatelink" onclick="toggle_private();" 161 >hide private</a>]</span></td> 162 </tr> 163 </table> 164 </td> 165 </tr> 166 <tr> 167 <td colspan="2" class="summary"> 168 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: 169 <code>__class__</code> 170 </p> 171 </td> 172 </tr> 173 </table> 174 <!-- ==================== METHOD DETAILS ==================== --> 175 <a name="section-MethodDetails"></a> 176 <table class="details" border="1" cellpadding="3" 177 cellspacing="0" width="100%" bgcolor="white"> 178 <tr bgcolor="#70b0f0" class="table-header"> 179 <td colspan="2" class="table-header"> 180 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 181 <tr valign="top"> 182 <td align="left"><span class="table-header">Method Details</span></td> 183 <td align="right" valign="top" 184 ><span class="options">[<a href="#section-MethodDetails" 185 class="privatelink" onclick="toggle_private();" 186 >hide private</a>]</span></td> 187 </tr> 188 </table> 189 </td> 190 </tr> 191 </table> 192 <a name="__init__"></a> 193 <div> 194 <table class="details" border="1" cellpadding="3" 195 cellspacing="0" width="100%" bgcolor="white"> 196 <tr><td> 197 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 198 <tr valign="top"><td> 199 <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, 200 <span class="sig-arg">stream</span>, 201 <span class="sig-arg">begin</span>, 202 <span class="sig-arg">chunksize</span>)</span> 203 <br /><em class="fname">(Constructor)</em> 204 </h3> 205 </td><td align="right" valign="top" 206 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.__init__">source code</a></span> 207 </td> 208 </tr></table> 209 210 <pre class="literalblock"> 211 Constructor. 212 213 Args: 214 stream: (io.Base, file object), the stream to wrap. 215 begin: int, the seek position the chunk begins at. 216 chunksize: int, the size of the chunk. 217 218 </pre> 219 <dl class="fields"> 220 <dt>Overrides: 221 object.__init__ 222 </dt> 223 </dl> 224 </td></tr></table> 225 </div> 226 <a name="read"></a> 227 <div> 228 <table class="details" border="1" cellpadding="3" 229 cellspacing="0" width="100%" bgcolor="white"> 230 <tr><td> 231 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 232 <tr valign="top"><td> 233 <h3 class="epydoc"><span class="sig"><span class="sig-name">read</span>(<span class="sig-arg">self</span>, 234 <span class="sig-arg">n</span>=<span class="sig-default">-1</span>)</span> 235 </h3> 236 </td><td align="right" valign="top" 237 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#_StreamSlice.read">source code</a></span> 238 </td> 239 </tr></table> 240 241 <pre class="literalblock"> 242 Read n bytes. 243 244 Args: 245 n, int, the number of bytes to read. 246 247 Returns: 248 A string of length 'n', or less if EOF is reached. 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 Mon Jun 5 13:38:40 2017 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