| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-ftplib.html" /> |
| 13 | <link rel="prev" href="module-urllib2.html" /> |
| 14 | <link rel="parent" href="internet.html" /> |
| 15 | <link rel="next" href="httpconnection-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>11.6 httplib -- HTTP protocol client</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="11.5.22 Examples" |
| 25 | href="urllib2-examples.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="11. Internet Protocols and" |
| 28 | href="internet.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="11.6.1 HTTPConnection Objects" |
| 31 | href="httpconnection-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="urllib2-examples.html">11.5.22 Examples</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="httpconnection-objects.html">11.6.1 HTTPConnection Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION0013600000000000000000"> |
| 56 | 11.6 <tt class="module">httplib</tt> -- |
| 57 | HTTP protocol client</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-httplib"></A> |
| 62 | |
| 63 | <P> |
| 64 | <a id='l2h-3296' xml:id='l2h-3296'></a><a id='l2h-3314' xml:id='l2h-3314'></a> |
| 65 | |
| 66 | <P> |
| 67 | This module defines classes which implement the client side of the |
| 68 | HTTP and HTTPS protocols. It is normally not used directly -- the |
| 69 | module <tt class="module"><a href="module-urllib.html">urllib</a></tt><a id='l2h-3315' xml:id='l2h-3315'></a> uses it to handle URLs |
| 70 | that use HTTP and HTTPS. |
| 71 | |
| 72 | <P> |
| 73 | <div class="note"><b class="label">Note:</b> |
| 74 | HTTPS support is only available if the <tt class="module"><a href="module-socket.html">socket</a></tt> module was |
| 75 | compiled with SSL support. |
| 76 | </div> |
| 77 | |
| 78 | <P> |
| 79 | <div class="note"><b class="label">Note:</b> |
| 80 | The public interface for this module changed substantially in Python |
| 81 | 2.0. The <tt class="class">HTTP</tt> class is retained only for backward |
| 82 | compatibility with 1.5.2. It should not be used in new code. Refer |
| 83 | to the online docstrings for usage. |
| 84 | </div> |
| 85 | |
| 86 | <P> |
| 87 | The module provides the following classes: |
| 88 | |
| 89 | <P> |
| 90 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 91 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3297' xml:id='l2h-3297' class="class">HTTPConnection</tt></b>(</nobr></td> |
| 92 | <td><var>host</var><big>[</big><var>, port</var><big>]</big><var></var>)</td></tr></table></dt> |
| 93 | <dd> |
| 94 | An <tt class="class">HTTPConnection</tt> instance represents one transaction with an HTTP |
| 95 | server. It should be instantiated passing it a host and optional port number. |
| 96 | If no port number is passed, the port is extracted from the host string if it |
| 97 | has the form <code><var>host</var>:<var>port</var></code>, else the default HTTP port (80) is |
| 98 | used. For example, the following calls all create instances that connect to |
| 99 | the server at the same host and port: |
| 100 | |
| 101 | <P> |
| 102 | <div class="verbatim"><pre> |
| 103 | >>> h1 = httplib.HTTPConnection('www.cwi.nl') |
| 104 | >>> h2 = httplib.HTTPConnection('www.cwi.nl:80') |
| 105 | >>> h3 = httplib.HTTPConnection('www.cwi.nl', 80) |
| 106 | </pre></div> |
| 107 | |
| 108 | <span class="versionnote">New in version 2.0.</span> |
| 109 | |
| 110 | </dl> |
| 111 | |
| 112 | <P> |
| 113 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 114 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3298' xml:id='l2h-3298' class="class">HTTPSConnection</tt></b>(</nobr></td> |
| 115 | <td><var>host</var><big>[</big><var>, port, key_file, cert_file</var><big>]</big><var></var>)</td></tr></table></dt> |
| 116 | <dd> |
| 117 | A subclass of <tt class="class">HTTPConnection</tt> that uses SSL for communication with |
| 118 | secure servers. Default port is <code>443</code>. |
| 119 | <var>key_file</var> is |
| 120 | the name of a PEM formatted file that contains your private |
| 121 | key. <var>cert_file</var> is a PEM formatted certificate chain file. |
| 122 | |
| 123 | <P> |
| 124 | <span class="warning"><b class="label">Warning:</b> |
| 125 | This does not do any certificate verification!</span> |
| 126 | |
| 127 | <P> |
| 128 | |
| 129 | <span class="versionnote">New in version 2.0.</span> |
| 130 | |
| 131 | </dl> |
| 132 | |
| 133 | <P> |
| 134 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 135 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3299' xml:id='l2h-3299' class="class">HTTPResponse</tt></b>(</nobr></td> |
| 136 | <td><var>sock</var><big>[</big><var>, debuglevel=0</var><big>]</big><var></var><big>[</big><var>, strict=0</var><big>]</big><var></var>)</td></tr></table></dt> |
| 137 | <dd> |
| 138 | Class whose instances are returned upon successful connection. Not |
| 139 | instantiated directly by user. |
| 140 | |
| 141 | <span class="versionnote">New in version 2.0.</span> |
| 142 | |
| 143 | </dl> |
| 144 | |
| 145 | <P> |
| 146 | The following exceptions are raised as appropriate: |
| 147 | |
| 148 | <P> |
| 149 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3300' xml:id='l2h-3300' class="exception">HTTPException</tt></b></dt> |
| 150 | <dd> |
| 151 | The base class of the other exceptions in this module. It is a |
| 152 | subclass of <tt class="exception">Exception</tt>. |
| 153 | |
| 154 | <span class="versionnote">New in version 2.0.</span> |
| 155 | |
| 156 | </dd></dl> |
| 157 | |
| 158 | <P> |
| 159 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3301' xml:id='l2h-3301' class="exception">NotConnected</tt></b></dt> |
| 160 | <dd> |
| 161 | A subclass of <tt class="exception">HTTPException</tt>. |
| 162 | |
| 163 | <span class="versionnote">New in version 2.0.</span> |
| 164 | |
| 165 | </dd></dl> |
| 166 | |
| 167 | <P> |
| 168 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3302' xml:id='l2h-3302' class="exception">InvalidURL</tt></b></dt> |
| 169 | <dd> |
| 170 | A subclass of <tt class="exception">HTTPException</tt>, raised if a port is given and is |
| 171 | either non-numeric or empty. |
| 172 | |
| 173 | <span class="versionnote">New in version 2.3.</span> |
| 174 | |
| 175 | </dd></dl> |
| 176 | |
| 177 | <P> |
| 178 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3303' xml:id='l2h-3303' class="exception">UnknownProtocol</tt></b></dt> |
| 179 | <dd> |
| 180 | A subclass of <tt class="exception">HTTPException</tt>. |
| 181 | |
| 182 | <span class="versionnote">New in version 2.0.</span> |
| 183 | |
| 184 | </dd></dl> |
| 185 | |
| 186 | <P> |
| 187 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3304' xml:id='l2h-3304' class="exception">UnknownTransferEncoding</tt></b></dt> |
| 188 | <dd> |
| 189 | A subclass of <tt class="exception">HTTPException</tt>. |
| 190 | |
| 191 | <span class="versionnote">New in version 2.0.</span> |
| 192 | |
| 193 | </dd></dl> |
| 194 | |
| 195 | <P> |
| 196 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3305' xml:id='l2h-3305' class="exception">UnimplementedFileMode</tt></b></dt> |
| 197 | <dd> |
| 198 | A subclass of <tt class="exception">HTTPException</tt>. |
| 199 | |
| 200 | <span class="versionnote">New in version 2.0.</span> |
| 201 | |
| 202 | </dd></dl> |
| 203 | |
| 204 | <P> |
| 205 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3306' xml:id='l2h-3306' class="exception">IncompleteRead</tt></b></dt> |
| 206 | <dd> |
| 207 | A subclass of <tt class="exception">HTTPException</tt>. |
| 208 | |
| 209 | <span class="versionnote">New in version 2.0.</span> |
| 210 | |
| 211 | </dd></dl> |
| 212 | |
| 213 | <P> |
| 214 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3307' xml:id='l2h-3307' class="exception">ImproperConnectionState</tt></b></dt> |
| 215 | <dd> |
| 216 | A subclass of <tt class="exception">HTTPException</tt>. |
| 217 | |
| 218 | <span class="versionnote">New in version 2.0.</span> |
| 219 | |
| 220 | </dd></dl> |
| 221 | |
| 222 | <P> |
| 223 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3308' xml:id='l2h-3308' class="exception">CannotSendRequest</tt></b></dt> |
| 224 | <dd> |
| 225 | A subclass of <tt class="exception">ImproperConnectionState</tt>. |
| 226 | |
| 227 | <span class="versionnote">New in version 2.0.</span> |
| 228 | |
| 229 | </dd></dl> |
| 230 | |
| 231 | <P> |
| 232 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3309' xml:id='l2h-3309' class="exception">CannotSendHeader</tt></b></dt> |
| 233 | <dd> |
| 234 | A subclass of <tt class="exception">ImproperConnectionState</tt>. |
| 235 | |
| 236 | <span class="versionnote">New in version 2.0.</span> |
| 237 | |
| 238 | </dd></dl> |
| 239 | |
| 240 | <P> |
| 241 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3310' xml:id='l2h-3310' class="exception">ResponseNotReady</tt></b></dt> |
| 242 | <dd> |
| 243 | A subclass of <tt class="exception">ImproperConnectionState</tt>. |
| 244 | |
| 245 | <span class="versionnote">New in version 2.0.</span> |
| 246 | |
| 247 | </dd></dl> |
| 248 | |
| 249 | <P> |
| 250 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3311' xml:id='l2h-3311' class="exception">BadStatusLine</tt></b></dt> |
| 251 | <dd> |
| 252 | A subclass of <tt class="exception">HTTPException</tt>. Raised if a server responds with a |
| 253 | HTTP status code that we don't understand. |
| 254 | |
| 255 | <span class="versionnote">New in version 2.0.</span> |
| 256 | |
| 257 | </dd></dl> |
| 258 | |
| 259 | <P> |
| 260 | The constants defined in this module are: |
| 261 | |
| 262 | <P> |
| 263 | <dl><dt><b><tt id='l2h-3312' xml:id='l2h-3312'>HTTP_PORT</tt></b></dt> |
| 264 | <dd> |
| 265 | The default port for the HTTP protocol (always <code>80</code>). |
| 266 | </dd></dl> |
| 267 | |
| 268 | <P> |
| 269 | <dl><dt><b><tt id='l2h-3313' xml:id='l2h-3313'>HTTPS_PORT</tt></b></dt> |
| 270 | <dd> |
| 271 | The default port for the HTTPS protocol (always <code>443</code>). |
| 272 | </dd></dl> |
| 273 | |
| 274 | <P> |
| 275 | and also the following constants for integer status codes: |
| 276 | |
| 277 | <P> |
| 278 | <div class="center"><table class="realtable"> |
| 279 | <thead> |
| 280 | <tr> |
| 281 | <th class="left" >Constant</th> |
| 282 | <th class="center">Value</th> |
| 283 | <th class="left" >Definition</th> |
| 284 | </tr> |
| 285 | </thead> |
| 286 | <tbody> |
| 287 | <tr><td class="left" valign="baseline"><tt class="constant">CONTINUE</tt></td> |
| 288 | <td class="center"><code>100</code></td> |
| 289 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.1" |
| 290 | >RFC 2616, Section 10.1.1</a></td></tr> |
| 291 | <tr><td class="left" valign="baseline"><tt class="constant">SWITCHING_PROTOCOLS</tt></td> |
| 292 | <td class="center"><code>101</code></td> |
| 293 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.2" |
| 294 | >RFC 2616, Section 10.1.2</a></td></tr> |
| 295 | <tr><td class="left" valign="baseline"><tt class="constant">PROCESSING</tt></td> |
| 296 | <td class="center"><code>102</code></td> |
| 297 | <td class="left" >WEBDAV, <a class="ulink" href="http://www.webdav.org/specs/rfc2518.html#STATUS_102" |
| 298 | >RFC 2518, Section 10.1</a></td></tr><P> |
| 299 | |
| 300 | <tr><td class="left" valign="baseline"><tt class="constant">OK</tt></td> |
| 301 | <td class="center"><code>200</code></td> |
| 302 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1" |
| 303 | >RFC 2616, Section 10.2.1</a></td></tr> |
| 304 | <tr><td class="left" valign="baseline"><tt class="constant">CREATED</tt></td> |
| 305 | <td class="center"><code>201</code></td> |
| 306 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2" |
| 307 | >RFC 2616, Section 10.2.2</a></td></tr> |
| 308 | <tr><td class="left" valign="baseline"><tt class="constant">ACCEPTED</tt></td> |
| 309 | <td class="center"><code>202</code></td> |
| 310 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3" |
| 311 | >RFC 2616, Section 10.2.3</a></td></tr> |
| 312 | <tr><td class="left" valign="baseline"><tt class="constant">NON_AUTHORITATIVE_INFORMATION</tt></td> |
| 313 | <td class="center"><code>203</code></td> |
| 314 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.4" |
| 315 | >RFC 2616, Section 10.2.4</a></td></tr> |
| 316 | <tr><td class="left" valign="baseline"><tt class="constant">NO_CONTENT</tt></td> |
| 317 | <td class="center"><code>204</code></td> |
| 318 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5" |
| 319 | >RFC 2616, Section 10.2.5</a></td></tr> |
| 320 | <tr><td class="left" valign="baseline"><tt class="constant">RESET_CONTENT</tt></td> |
| 321 | <td class="center"><code>205</code></td> |
| 322 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.6" |
| 323 | >RFC 2616, Section 10.2.6</a></td></tr> |
| 324 | <tr><td class="left" valign="baseline"><tt class="constant">PARTIAL_CONTENT</tt></td> |
| 325 | <td class="center"><code>206</code></td> |
| 326 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.7" |
| 327 | >RFC 2616, Section 10.2.7</a></td></tr> |
| 328 | <tr><td class="left" valign="baseline"><tt class="constant">MULTI_STATUS</tt></td> |
| 329 | <td class="center"><code>207</code></td> |
| 330 | <td class="left" >WEBDAV <a class="ulink" href="http://www.webdav.org/specs/rfc2518.html#STATUS_207" |
| 331 | >RFC 2518, Section 10.2</a></td></tr> |
| 332 | <tr><td class="left" valign="baseline"><tt class="constant">IM_USED</tt></td> |
| 333 | <td class="center"><code>226</code></td> |
| 334 | <td class="left" >Delta encoding in HTTP, <a class="rfc" id='rfcref-90088' xml:id='rfcref-90088' |
| 335 | href="http://www.faqs.org/rfcs/rfc3229.html">RFC 3229</a>, Section 10.4.1</td></tr><P> |
| 336 | |
| 337 | <tr><td class="left" valign="baseline"><tt class="constant">MULTIPLE_CHOICES</tt></td> |
| 338 | <td class="center"><code>300</code></td> |
| 339 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1" |
| 340 | >RFC 2616, Section 10.3.1</a></td></tr> |
| 341 | <tr><td class="left" valign="baseline"><tt class="constant">MOVED_PERMANENTLY</tt></td> |
| 342 | <td class="center"><code>301</code></td> |
| 343 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2" |
| 344 | >RFC 2616, Section 10.3.2</a></td></tr> |
| 345 | <tr><td class="left" valign="baseline"><tt class="constant">FOUND</tt></td> |
| 346 | <td class="center"><code>302</code></td> |
| 347 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3" |
| 348 | >RFC 2616, Section 10.3.3</a></td></tr> |
| 349 | <tr><td class="left" valign="baseline"><tt class="constant">SEE_OTHER</tt></td> |
| 350 | <td class="center"><code>303</code></td> |
| 351 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4" |
| 352 | >RFC 2616, Section 10.3.4</a></td></tr> |
| 353 | <tr><td class="left" valign="baseline"><tt class="constant">NOT_MODIFIED</tt></td> |
| 354 | <td class="center"><code>304</code></td> |
| 355 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5" |
| 356 | >RFC 2616, Section 10.3.5</a></td></tr> |
| 357 | <tr><td class="left" valign="baseline"><tt class="constant">USE_PROXY</tt></td> |
| 358 | <td class="center"><code>305</code></td> |
| 359 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.6" |
| 360 | >RFC 2616, Section 10.3.6</a></td></tr> |
| 361 | <tr><td class="left" valign="baseline"><tt class="constant">TEMPORARY_REDIRECT</tt></td> |
| 362 | <td class="center"><code>307</code></td> |
| 363 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8" |
| 364 | >RFC 2616, Section 10.3.8</a></td></tr><P> |
| 365 | |
| 366 | <tr><td class="left" valign="baseline"><tt class="constant">BAD_REQUEST</tt></td> |
| 367 | <td class="center"><code>400</code></td> |
| 368 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1" |
| 369 | >RFC 2616, Section 10.4.1</a></td></tr> |
| 370 | <tr><td class="left" valign="baseline"><tt class="constant">UNAUTHORIZED</tt></td> |
| 371 | <td class="center"><code>401</code></td> |
| 372 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2" |
| 373 | >RFC 2616, Section 10.4.2</a></td></tr> |
| 374 | <tr><td class="left" valign="baseline"><tt class="constant">PAYMENT_REQUIRED</tt></td> |
| 375 | <td class="center"><code>402</code></td> |
| 376 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.3" |
| 377 | >RFC 2616, Section 10.4.3</a></td></tr> |
| 378 | <tr><td class="left" valign="baseline"><tt class="constant">FORBIDDEN</tt></td> |
| 379 | <td class="center"><code>403</code></td> |
| 380 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4" |
| 381 | >RFC 2616, Section 10.4.4</a></td></tr> |
| 382 | <tr><td class="left" valign="baseline"><tt class="constant">NOT_FOUND</tt></td> |
| 383 | <td class="center"><code>404</code></td> |
| 384 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5" |
| 385 | >RFC 2616, Section 10.4.5</a></td></tr> |
| 386 | <tr><td class="left" valign="baseline"><tt class="constant">METHOD_NOT_ALLOWED</tt></td> |
| 387 | <td class="center"><code>405</code></td> |
| 388 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6" |
| 389 | >RFC 2616, Section 10.4.6</a></td></tr> |
| 390 | <tr><td class="left" valign="baseline"><tt class="constant">NOT_ACCEPTABLE</tt></td> |
| 391 | <td class="center"><code>406</code></td> |
| 392 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7" |
| 393 | >RFC 2616, Section 10.4.7</a></td></tr> |
| 394 | <tr><td class="left" valign="baseline"><tt class="constant">PROXY_AUTHENTICATION_REQUIRED</tt></td> |
| 395 | <td class="center"><code>407</code></td> |
| 396 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.8" |
| 397 | >RFC 2616, Section 10.4.8</a></td></tr> |
| 398 | <tr><td class="left" valign="baseline"><tt class="constant">REQUEST_TIMEOUT</tt></td> |
| 399 | <td class="center"><code>408</code></td> |
| 400 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.9" |
| 401 | >RFC 2616, Section 10.4.9</a></td></tr> |
| 402 | <tr><td class="left" valign="baseline"><tt class="constant">CONFLICT</tt></td> |
| 403 | <td class="center"><code>409</code></td> |
| 404 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10" |
| 405 | >RFC 2616, Section 10.4.10</a></td></tr> |
| 406 | <tr><td class="left" valign="baseline"><tt class="constant">GONE</tt></td> |
| 407 | <td class="center"><code>410</code></td> |
| 408 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11" |
| 409 | >RFC 2616, Section 10.4.11</a></td></tr> |
| 410 | <tr><td class="left" valign="baseline"><tt class="constant">LENGTH_REQUIRED</tt></td> |
| 411 | <td class="center"><code>411</code></td> |
| 412 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.12" |
| 413 | >RFC 2616, Section 10.4.12</a></td></tr> |
| 414 | <tr><td class="left" valign="baseline"><tt class="constant">PRECONDITION_FAILED</tt></td> |
| 415 | <td class="center"><code>412</code></td> |
| 416 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.13" |
| 417 | >RFC 2616, Section 10.4.13</a></td></tr> |
| 418 | <tr><td class="left" valign="baseline"><tt class="constant">REQUEST_ENTITY_TOO_LARGE</tt></td> |
| 419 | <td class="center"><code>413</code></td> |
| 420 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.14" |
| 421 | >RFC 2616, Section 10.4.14</a></td></tr> |
| 422 | <tr><td class="left" valign="baseline"><tt class="constant">REQUEST_URI_TOO_LONG</tt></td> |
| 423 | <td class="center"><code>414</code></td> |
| 424 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.15" |
| 425 | >RFC 2616, Section 10.4.15</a></td></tr> |
| 426 | <tr><td class="left" valign="baseline"><tt class="constant">UNSUPPORTED_MEDIA_TYPE</tt></td> |
| 427 | <td class="center"><code>415</code></td> |
| 428 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16" |
| 429 | >RFC 2616, Section 10.4.16</a></td></tr> |
| 430 | <tr><td class="left" valign="baseline"><tt class="constant">REQUESTED_RANGE_NOT_SATISFIABLE</tt></td> |
| 431 | <td class="center"><code>416</code></td> |
| 432 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.17" |
| 433 | >RFC 2616, Section 10.4.17</a></td></tr> |
| 434 | <tr><td class="left" valign="baseline"><tt class="constant">EXPECTATION_FAILED</tt></td> |
| 435 | <td class="center"><code>417</code></td> |
| 436 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.18" |
| 437 | >RFC 2616, Section 10.4.18</a></td></tr> |
| 438 | <tr><td class="left" valign="baseline"><tt class="constant">UNPROCESSABLE_ENTITY</tt></td> |
| 439 | <td class="center"><code>422</code></td> |
| 440 | <td class="left" >WEBDAV, <a class="ulink" href="http://www.webdav.org/specs/rfc2518.html#STATUS_422" |
| 441 | >RFC 2518, Section 10.3</a></td></tr> |
| 442 | <tr><td class="left" valign="baseline"><tt class="constant">LOCKED</tt></td> |
| 443 | <td class="center"><code>423</code></td> |
| 444 | <td class="left" >WEBDAV <a class="ulink" href="http://www.webdav.org/specs/rfc2518.html#STATUS_423" |
| 445 | >RFC 2518, Section 10.4</a></td></tr> |
| 446 | <tr><td class="left" valign="baseline"><tt class="constant">FAILED_DEPENDENCY</tt></td> |
| 447 | <td class="center"><code>424</code></td> |
| 448 | <td class="left" >WEBDAV, <a class="ulink" href="http://www.webdav.org/specs/rfc2518.html#STATUS_424" |
| 449 | >RFC 2518, Section 10.5</a></td></tr> |
| 450 | <tr><td class="left" valign="baseline"><tt class="constant">UPGRADE_REQUIRED</tt></td> |
| 451 | <td class="center"><code>426</code></td> |
| 452 | <td class="left" >HTTP Upgrade to TLS, <a class="rfc" id='rfcref-90090' xml:id='rfcref-90090' |
| 453 | href="http://www.faqs.org/rfcs/rfc2817.html">RFC 2817</a>, Section 6</td></tr><P> |
| 454 | |
| 455 | <tr><td class="left" valign="baseline"><tt class="constant">INTERNAL_SERVER_ERROR</tt></td> |
| 456 | <td class="center"><code>500</code></td> |
| 457 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1" |
| 458 | >RFC 2616, Section 10.5.1</a></td></tr> |
| 459 | <tr><td class="left" valign="baseline"><tt class="constant">NOT_IMPLEMENTED</tt></td> |
| 460 | <td class="center"><code>501</code></td> |
| 461 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2" |
| 462 | >RFC 2616, Section 10.5.2</a></td></tr> |
| 463 | <tr><td class="left" valign="baseline"><tt class="constant">BAD_GATEWAY</tt></td> |
| 464 | <td class="center"><code>502</code></td> |
| 465 | <td class="left" >HTTP/1.1 <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3" |
| 466 | >RFC 2616, Section 10.5.3</a></td></tr> |
| 467 | <tr><td class="left" valign="baseline"><tt class="constant">SERVICE_UNAVAILABLE</tt></td> |
| 468 | <td class="center"><code>503</code></td> |
| 469 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4" |
| 470 | >RFC 2616, Section 10.5.4</a></td></tr> |
| 471 | <tr><td class="left" valign="baseline"><tt class="constant">GATEWAY_TIMEOUT</tt></td> |
| 472 | <td class="center"><code>504</code></td> |
| 473 | <td class="left" >HTTP/1.1 <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5" |
| 474 | >RFC 2616, Section 10.5.5</a></td></tr> |
| 475 | <tr><td class="left" valign="baseline"><tt class="constant">HTTP_VERSION_NOT_SUPPORTED</tt></td> |
| 476 | <td class="center"><code>505</code></td> |
| 477 | <td class="left" >HTTP/1.1, <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.6" |
| 478 | >RFC 2616, Section 10.5.6</a></td></tr> |
| 479 | <tr><td class="left" valign="baseline"><tt class="constant">INSUFFICIENT_STORAGE</tt></td> |
| 480 | <td class="center"><code>507</code></td> |
| 481 | <td class="left" >WEBDAV, <a class="ulink" href="http://www.webdav.org/specs/rfc2518.html#STATUS_507" |
| 482 | >RFC 2518, Section 10.6</a></td></tr> |
| 483 | <tr><td class="left" valign="baseline"><tt class="constant">NOT_EXTENDED</tt></td> |
| 484 | <td class="center"><code>510</code></td> |
| 485 | <td class="left" >An HTTP Extension Framework, <a class="rfc" id='rfcref-90092' xml:id='rfcref-90092' |
| 486 | href="http://www.faqs.org/rfcs/rfc2774.html">RFC 2774</a>, Section 7</td></tr></tbody> |
| 487 | </table></div> |
| 488 | |
| 489 | <P> |
| 490 | |
| 491 | <p><br /></p><hr class='online-navigation' /> |
| 492 | <div class='online-navigation'> |
| 493 | <!--Table of Child-Links--> |
| 494 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 495 | |
| 496 | <UL CLASS="ChildLinks"> |
| 497 | <LI><A href="httpconnection-objects.html">11.6.1 HTTPConnection Objects</a> |
| 498 | <LI><A href="httpresponse-objects.html">11.6.2 HTTPResponse Objects</a> |
| 499 | <LI><A href="httplib-examples.html">11.6.3 Examples</a> |
| 500 | </ul> |
| 501 | <!--End of Table of Child-Links--> |
| 502 | </div> |
| 503 | |
| 504 | <DIV CLASS="navigation"> |
| 505 | <div class='online-navigation'> |
| 506 | <p></p><hr /> |
| 507 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 508 | <tr> |
| 509 | <td class='online-navigation'><a rel="prev" title="11.5.22 Examples" |
| 510 | href="urllib2-examples.html"><img src='../icons/previous.png' |
| 511 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 512 | <td class='online-navigation'><a rel="parent" title="11. Internet Protocols and" |
| 513 | href="internet.html"><img src='../icons/up.png' |
| 514 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 515 | <td class='online-navigation'><a rel="next" title="11.6.1 HTTPConnection Objects" |
| 516 | href="httpconnection-objects.html"><img src='../icons/next.png' |
| 517 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 518 | <td align="center" width="100%">Python Library Reference</td> |
| 519 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 520 | href="contents.html"><img src='../icons/contents.png' |
| 521 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 522 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 523 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 524 | <td class='online-navigation'><a rel="index" title="Index" |
| 525 | href="genindex.html"><img src='../icons/index.png' |
| 526 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 527 | </tr></table> |
| 528 | <div class='online-navigation'> |
| 529 | <b class="navlabel">Previous:</b> |
| 530 | <a class="sectref" rel="prev" href="urllib2-examples.html">11.5.22 Examples</A> |
| 531 | <b class="navlabel">Up:</b> |
| 532 | <a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A> |
| 533 | <b class="navlabel">Next:</b> |
| 534 | <a class="sectref" rel="next" href="httpconnection-objects.html">11.6.1 HTTPConnection Objects</A> |
| 535 | </div> |
| 536 | </div> |
| 537 | <hr /> |
| 538 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 539 | </DIV> |
| 540 | <!--End of Navigation Panel--> |
| 541 | <ADDRESS> |
| 542 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 543 | </ADDRESS> |
| 544 | </BODY> |
| 545 | </HTML> |