jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 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" /> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 13 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 14 | <meta name='aesop' content='information' /> |
| 15 | <title>1.1.3 Response Objects</title> |
| 16 | </head> |
| 17 | <body> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 18 | <div class="navigation"> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 19 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 20 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 21 | <tr> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 22 | <td class='online-navigation'><a rel="prev" title="1.1.2 cache Objects" |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 23 | href="cache-objects.html"><img src='previous.png' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 24 | border='0' height='32' alt='Previous Page' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 25 | <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive" |
| 26 | href="module-httplib2.html"><img src='up.png' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 27 | border='0' height='32' alt='Up one Level' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 28 | <td class='online-navigation'><a rel="next" title="1.1.4 Examples" |
| 29 | href="httplib2-example.html"><img src='next.png' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 30 | border='0' height='32' alt='Next Page' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 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' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 34 | border='0' height='32' alt='Contents' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 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> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 42 | <a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</a> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 43 | <b class="navlabel">Up:</b> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 44 | <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</a> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 45 | <b class="navlabel">Next:</b> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 46 | <a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</a> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 47 | </div> |
| 48 | <hr /></div> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 49 | </div> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 50 | <!--End of Navigation Panel--> |
| 51 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 52 | <h2><a name="SECTION002130000000000000000"></a> |
| 53 | <a name="response-objects"></a> |
| 54 | <br> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 55 | 1.1.3 Response Objects |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 56 | </h2> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 57 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 58 | <p> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 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 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 64 | <p> |
joe.gregorio | ab704ef | 2007-10-23 15:26:12 +0000 | [diff] [blame] | 65 | <dl><dt><b><tt id='l2h-26' xml:id='l2h-26' class="member">fromcache</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 66 | <dd> |
| 67 | If <code>true</code> the the response was returned from the cache. |
| 68 | </dl> |
| 69 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 70 | <p> |
joe.gregorio | ab704ef | 2007-10-23 15:26:12 +0000 | [diff] [blame] | 71 | <dl><dt><b><tt id='l2h-27' xml:id='l2h-27' class="member">version</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 72 | <dd> |
| 73 | The version of HTTP that the server supports. A value |
| 74 | of 11 means '1.1'. |
| 75 | </dl> |
| 76 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 77 | <p> |
joe.gregorio | ab704ef | 2007-10-23 15:26:12 +0000 | [diff] [blame] | 78 | <dl><dt><b><tt id='l2h-28' xml:id='l2h-28' class="member">status</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 79 | <dd> |
| 80 | The numerical HTTP status code returned in the response. |
| 81 | </dl> |
| 82 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 83 | <p> |
joe.gregorio | ab704ef | 2007-10-23 15:26:12 +0000 | [diff] [blame] | 84 | <dl><dt><b><tt id='l2h-29' xml:id='l2h-29' class="member">reason</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 85 | <dd> |
| 86 | The human readable component of the HTTP response status code. |
| 87 | </dl> |
| 88 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 89 | <p> |
joe.gregorio | ab704ef | 2007-10-23 15:26:12 +0000 | [diff] [blame] | 90 | <dl><dt><b><tt id='l2h-30' xml:id='l2h-30' class="member">previous</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 91 | <dd> |
| 92 | If redirects are followed then the <tt class="class">Response</tt> object returned |
| 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 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 99 | <p> |
jcgregorio | 772adc8 | 2006-11-17 21:52:34 +0000 | [diff] [blame] | 100 | The Response object also populates the header <code>content-location</code>, that |
jcgregorio | f76c951 | 2006-11-07 18:01:50 +0000 | [diff] [blame] | 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 |
jcgregorio | cde4f09 | 2007-03-08 21:59:04 +0000 | [diff] [blame] | 105 | chain of redirects. If <tt class="member">Http.force_exception_to_status_code</tt> 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 error |
| 108 | in the status code, but the complete chain of previous responses will |
| 109 | still be in tact. |
jcgregorio | f76c951 | 2006-11-07 18:01:50 +0000 | [diff] [blame] | 110 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 111 | <p> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 112 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 113 | <div class="navigation"> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 114 | <div class='online-navigation'> |
| 115 | <p></p><hr /> |
| 116 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 117 | <tr> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 118 | <td class='online-navigation'><a rel="prev" title="1.1.2 cache Objects" |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 119 | href="cache-objects.html"><img src='previous.png' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 120 | border='0' height='32' alt='Previous Page' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 121 | <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive" |
| 122 | href="module-httplib2.html"><img src='up.png' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 123 | border='0' height='32' alt='Up one Level' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 124 | <td class='online-navigation'><a rel="next" title="1.1.4 Examples" |
| 125 | href="httplib2-example.html"><img src='next.png' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 126 | border='0' height='32' alt='Next Page' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 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' |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 130 | border='0' height='32' alt='Contents' width='32' /></a></td> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 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> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 138 | <a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</a> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 139 | <b class="navlabel">Up:</b> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 140 | <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</a> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 141 | <b class="navlabel">Next:</b> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 142 | <a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</a> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 143 | </div> |
| 144 | </div> |
| 145 | <hr /> |
jcgregorio | cde4f09 | 2007-03-08 21:59:04 +0000 | [diff] [blame] | 146 | <span class="release-info">Release 0.3, documentation updated on Mar 8, 2007.</span> |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 147 | </div> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 148 | <!--End of Navigation Panel--> |
| 149 | |
jcgregorio | 88ada9a | 2007-05-03 13:20:38 +0000 | [diff] [blame] | 150 | </body> |
| 151 | </html> |