| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <link rel="STYLESHEET" href="ref.css" type='text/css' /> | |
| 5 <link rel="first" href="ref.html" title='The httplib2 Library' /> | |
| 6 <link rel='contents' href='contents.html' title="Contents" /> | |
| 7 <link rel='last' href='about.html' title='About this document...' /> | |
| 8 <link rel='help' href='about.html' title='About this document...' /> | |
| 9 <link rel="next" href="httplib2-example.html" /> | |
| 10 <link rel="prev" href="cache-objects.html" /> | |
| 11 <link rel="parent" href="module-httplib2.html" /> | |
| 12 <link rel="next" href="httplib2-example.html" /> | |
| 13 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 14 <meta name='aesop' content='information' /> | |
| 15 <title>1.1.3 Response Objects</title> | |
| 16 </head> | |
| 17 <body> | |
| 18 <div class="navigation"> | |
| 19 <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
| 20 <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
| 21 <tr> | |
| 22 <td class='online-navigation'><a rel="prev" title="1.1.2 cache Objects" | |
| 23 href="cache-objects.html"><img src='previous.png' | |
| 24 border='0' height='32' alt='Previous Page' width='32' /></a></td> | |
| 25 <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensiv
e" | |
| 26 href="module-httplib2.html"><img src='up.png' | |
| 27 border='0' height='32' alt='Up one Level' width='32' /></a></td> | |
| 28 <td class='online-navigation'><a rel="next" title="1.1.4 Examples" | |
| 29 href="httplib2-example.html"><img src='next.png' | |
| 30 border='0' height='32' alt='Next Page' width='32' /></a></td> | |
| 31 <td align="center" width="100%">The httplib2 Library</td> | |
| 32 <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
| 33 href="contents.html"><img src='contents.png' | |
| 34 border='0' height='32' alt='Contents' width='32' /></a></td> | |
| 35 <td class='online-navigation'><img src='blank.png' | |
| 36 border='0' height='32' alt='' width='32' /></td> | |
| 37 <td class='online-navigation'><img src='blank.png' | |
| 38 border='0' height='32' alt='' width='32' /></td> | |
| 39 </tr></table> | |
| 40 <div class='online-navigation'> | |
| 41 <b class="navlabel">Previous:</b> | |
| 42 <a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</a> | |
| 43 <b class="navlabel">Up:</b> | |
| 44 <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A compr
ehensive</a> | |
| 45 <b class="navlabel">Next:</b> | |
| 46 <a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</a> | |
| 47 </div> | |
| 48 <hr /></div> | |
| 49 </div> | |
| 50 <!--End of Navigation Panel--> | |
| 51 | |
| 52 <h2><a name="SECTION002130000000000000000"></a> | |
| 53 <a name="response-objects"></a> | |
| 54 <br> | |
| 55 1.1.3 Response Objects | |
| 56 </h2> | |
| 57 | |
| 58 <p> | |
| 59 Response objects are derived from <tt class="class">dict</tt> and map | |
| 60 header names (lower case with the trailing colon removed) | |
| 61 to header values. In addition to the dict methods | |
| 62 a Response object also has: | |
| 63 | |
| 64 <p> | |
| 65 <dl><dt><b><tt id='l2h-26' xml:id='l2h-26' class="member">fromcache</tt></b></dt
> | |
| 66 <dd> | |
| 67 If <code>true</code> the the response was returned from the cache. | |
| 68 </dl> | |
| 69 | |
| 70 <p> | |
| 71 <dl><dt><b><tt id='l2h-27' xml:id='l2h-27' class="member">version</tt></b></dt> | |
| 72 <dd> | |
| 73 The version of HTTP that the server supports. A value | |
| 74 of 11 means '1.1'. | |
| 75 </dl> | |
| 76 | |
| 77 <p> | |
| 78 <dl><dt><b><tt id='l2h-28' xml:id='l2h-28' class="member">status</tt></b></dt> | |
| 79 <dd> | |
| 80 The numerical HTTP status code returned in the response. | |
| 81 </dl> | |
| 82 | |
| 83 <p> | |
| 84 <dl><dt><b><tt id='l2h-29' xml:id='l2h-29' class="member">reason</tt></b></dt> | |
| 85 <dd> | |
| 86 The human readable component of the HTTP response status code. | |
| 87 </dl> | |
| 88 | |
| 89 <p> | |
| 90 <dl><dt><b><tt id='l2h-30' xml:id='l2h-30' class="member">previous</tt></b></dt> | |
| 91 <dd> | |
| 92 If redirects are followed then the <tt class="class">Response</tt> object return
ed | |
| 93 is just for the very last HTTP request and <var>previous</var> points to | |
| 94 the previous <tt class="class">Response</tt> object. In this manner they form a
chain | |
| 95 going back through the responses to the very first response. | |
| 96 Will be <code>None</code> if there are no previous respones. | |
| 97 </dl> | |
| 98 | |
| 99 <p> | |
| 100 The Response object also populates the header <code>content-location</code>, tha
t | |
| 101 contains the URI that was ultimately requested. This is useful if | |
| 102 redirects were encountered, you can determine the ultimate URI that | |
| 103 the request was sent to. All Response objects contain this key value, | |
| 104 including <code>previous</code> responses so you can determine the entire | |
| 105 chain of redirects. If <tt class="member">Http.force_exception_to_status_code</t
t> is <code>True</code> | |
| 106 and the number of redirects has exceeded the number of allowed number | |
| 107 of redirects then the <tt class="class">Response</tt> object will report the err
or | |
| 108 in the status code, but the complete chain of previous responses will | |
| 109 still be in tact. | |
| 110 | |
| 111 <p> | |
| 112 | |
| 113 <div class="navigation"> | |
| 114 <div class='online-navigation'> | |
| 115 <p></p><hr /> | |
| 116 <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
| 117 <tr> | |
| 118 <td class='online-navigation'><a rel="prev" title="1.1.2 cache Objects" | |
| 119 href="cache-objects.html"><img src='previous.png' | |
| 120 border='0' height='32' alt='Previous Page' width='32' /></a></td> | |
| 121 <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensiv
e" | |
| 122 href="module-httplib2.html"><img src='up.png' | |
| 123 border='0' height='32' alt='Up one Level' width='32' /></a></td> | |
| 124 <td class='online-navigation'><a rel="next" title="1.1.4 Examples" | |
| 125 href="httplib2-example.html"><img src='next.png' | |
| 126 border='0' height='32' alt='Next Page' width='32' /></a></td> | |
| 127 <td align="center" width="100%">The httplib2 Library</td> | |
| 128 <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
| 129 href="contents.html"><img src='contents.png' | |
| 130 border='0' height='32' alt='Contents' width='32' /></a></td> | |
| 131 <td class='online-navigation'><img src='blank.png' | |
| 132 border='0' height='32' alt='' width='32' /></td> | |
| 133 <td class='online-navigation'><img src='blank.png' | |
| 134 border='0' height='32' alt='' width='32' /></td> | |
| 135 </tr></table> | |
| 136 <div class='online-navigation'> | |
| 137 <b class="navlabel">Previous:</b> | |
| 138 <a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</a> | |
| 139 <b class="navlabel">Up:</b> | |
| 140 <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A compr
ehensive</a> | |
| 141 <b class="navlabel">Next:</b> | |
| 142 <a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</a> | |
| 143 </div> | |
| 144 </div> | |
| 145 <hr /> | |
| 146 <span class="release-info">Release 0.3, documentation updated on Mar 8, 2007.</s
pan> | |
| 147 </div> | |
| 148 <!--End of Navigation Panel--> | |
| 149 | |
| 150 </body> | |
| 151 </html> | |
| OLD | NEW |