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" /> |
| 13 | <meta name='aesop' content='information' /> |
| 14 | <title>1.1.3 Response Objects</title> |
| 15 | </head> |
| 16 | <body> |
| 17 | <DIV CLASS="navigation"> |
| 18 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 19 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 20 | <tr> |
| 21 | <td class='online-navigation'><a rel="prev" title="1.1.2 Cache Objects" |
| 22 | href="cache-objects.html"><img src='previous.png' |
| 23 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 24 | <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive" |
| 25 | href="module-httplib2.html"><img src='up.png' |
| 26 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="next" title="1.1.4 Examples" |
| 28 | href="httplib2-example.html"><img src='next.png' |
| 29 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 30 | <td align="center" width="100%">The httplib2 Library</td> |
| 31 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 32 | href="contents.html"><img src='contents.png' |
| 33 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 34 | <td class='online-navigation'><img src='blank.png' |
| 35 | border='0' height='32' alt='' width='32' /></td> |
| 36 | <td class='online-navigation'><img src='blank.png' |
| 37 | border='0' height='32' alt='' width='32' /></td> |
| 38 | </tr></table> |
| 39 | <div class='online-navigation'> |
| 40 | <b class="navlabel">Previous:</b> |
| 41 | <a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</A> |
| 42 | <b class="navlabel">Up:</b> |
| 43 | <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</A> |
| 44 | <b class="navlabel">Next:</b> |
| 45 | <a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</A> |
| 46 | </div> |
| 47 | <hr /></div> |
| 48 | </DIV> |
| 49 | <!--End of Navigation Panel--> |
| 50 | |
| 51 | <H2><A NAME="SECTION002130000000000000000"></A> |
| 52 | <A NAME="response-objects"></A> |
| 53 | <BR> |
| 54 | 1.1.3 Response Objects |
| 55 | </H2> |
| 56 | |
| 57 | <P> |
| 58 | Response objects are derived from <tt class="class">dict</tt> and map |
| 59 | header names (lower case with the trailing colon removed) |
| 60 | to header values. In addition to the dict methods |
| 61 | a Response object also has: |
| 62 | |
| 63 | <P> |
jcgregorio | ee542cc | 2006-11-16 04:43:19 +0000 | [diff] [blame] | 64 | <dl><dt><b><tt id='l2h-20' xml:id='l2h-20' class="member">fromcache</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 65 | <dd> |
| 66 | If <code>true</code> the the response was returned from the cache. |
| 67 | </dl> |
| 68 | |
| 69 | <P> |
jcgregorio | ee542cc | 2006-11-16 04:43:19 +0000 | [diff] [blame] | 70 | <dl><dt><b><tt id='l2h-21' xml:id='l2h-21' class="member">version</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 71 | <dd> |
| 72 | The version of HTTP that the server supports. A value |
| 73 | of 11 means '1.1'. |
| 74 | </dl> |
| 75 | |
| 76 | <P> |
jcgregorio | ee542cc | 2006-11-16 04:43:19 +0000 | [diff] [blame] | 77 | <dl><dt><b><tt id='l2h-22' xml:id='l2h-22' class="member">status</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 78 | <dd> |
| 79 | The numerical HTTP status code returned in the response. |
| 80 | </dl> |
| 81 | |
| 82 | <P> |
jcgregorio | ee542cc | 2006-11-16 04:43:19 +0000 | [diff] [blame] | 83 | <dl><dt><b><tt id='l2h-23' xml:id='l2h-23' class="member">reason</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 84 | <dd> |
| 85 | The human readable component of the HTTP response status code. |
| 86 | </dl> |
| 87 | |
| 88 | <P> |
jcgregorio | ee542cc | 2006-11-16 04:43:19 +0000 | [diff] [blame] | 89 | <dl><dt><b><tt id='l2h-24' xml:id='l2h-24' class="member">previous</tt></b></dt> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 90 | <dd> |
| 91 | If redirects are followed then the <tt class="class">Response</tt> object returned |
| 92 | is just for the very last HTTP request and <var>previous</var> points to |
| 93 | the previous <tt class="class">Response</tt> object. In this manner they form a chain |
| 94 | going back through the responses to the very first response. |
| 95 | Will be <code>None</code> if there are no previous respones. |
| 96 | </dl> |
| 97 | |
| 98 | <P> |
jcgregorio | 772adc8 | 2006-11-17 21:52:34 +0000 | [diff] [blame^] | 99 | The Response object also populates the header <code>content-location</code>, that |
jcgregorio | f76c951 | 2006-11-07 18:01:50 +0000 | [diff] [blame] | 100 | contains the URI that was ultimately requested. This is useful if |
| 101 | redirects were encountered, you can determine the ultimate URI that |
| 102 | the request was sent to. All Response objects contain this key value, |
| 103 | including <code>previous</code> responses so you can determine the entire |
| 104 | chain of redirects. |
| 105 | |
| 106 | <P> |
jcgregorio | 26c0cd7 | 2006-07-03 17:36:17 +0000 | [diff] [blame] | 107 | |
| 108 | <DIV CLASS="navigation"> |
| 109 | <div class='online-navigation'> |
| 110 | <p></p><hr /> |
| 111 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 112 | <tr> |
| 113 | <td class='online-navigation'><a rel="prev" title="1.1.2 Cache Objects" |
| 114 | href="cache-objects.html"><img src='previous.png' |
| 115 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 116 | <td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive" |
| 117 | href="module-httplib2.html"><img src='up.png' |
| 118 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 119 | <td class='online-navigation'><a rel="next" title="1.1.4 Examples" |
| 120 | href="httplib2-example.html"><img src='next.png' |
| 121 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 122 | <td align="center" width="100%">The httplib2 Library</td> |
| 123 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 124 | href="contents.html"><img src='contents.png' |
| 125 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 126 | <td class='online-navigation'><img src='blank.png' |
| 127 | border='0' height='32' alt='' width='32' /></td> |
| 128 | <td class='online-navigation'><img src='blank.png' |
| 129 | border='0' height='32' alt='' width='32' /></td> |
| 130 | </tr></table> |
| 131 | <div class='online-navigation'> |
| 132 | <b class="navlabel">Previous:</b> |
| 133 | <a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</A> |
| 134 | <b class="navlabel">Up:</b> |
| 135 | <a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</A> |
| 136 | <b class="navlabel">Next:</b> |
| 137 | <a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</A> |
| 138 | </div> |
| 139 | </div> |
| 140 | <hr /> |
| 141 | <span class="release-info">Release 0.2, documentation updated on July 2, 2006.</span> |
| 142 | </DIV> |
| 143 | <!--End of Navigation Panel--> |
| 144 | |
| 145 | </BODY> |
| 146 | </HTML> |