blob: 28e585b1693904d3a6a9a7b0a578e9ccfc80b78c [file] [log] [blame]
jcgregorio26c0cd72006-07-03 17:36:17 +00001<!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>
541.1.3 Response Objects
55</H2>
56
57<P>
58Response objects are derived from <tt class="class">dict</tt> and map
59header names (lower case with the trailing colon removed)
60to header values. In addition to the dict methods
61a Response object also has:
62
63<P>
jcgregorioee542cc2006-11-16 04:43:19 +000064<dl><dt><b><tt id='l2h-20' xml:id='l2h-20' class="member">fromcache</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000065<dd>
66If <code>true</code> the the response was returned from the cache.
67</dl>
68
69<P>
jcgregorioee542cc2006-11-16 04:43:19 +000070<dl><dt><b><tt id='l2h-21' xml:id='l2h-21' class="member">version</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000071<dd>
72The version of HTTP that the server supports. A value
73of 11 means '1.1'.
74</dl>
75
76<P>
jcgregorioee542cc2006-11-16 04:43:19 +000077<dl><dt><b><tt id='l2h-22' xml:id='l2h-22' class="member">status</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000078<dd>
79The numerical HTTP status code returned in the response.
80</dl>
81
82<P>
jcgregorioee542cc2006-11-16 04:43:19 +000083<dl><dt><b><tt id='l2h-23' xml:id='l2h-23' class="member">reason</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000084<dd>
85The human readable component of the HTTP response status code.
86</dl>
87
88<P>
jcgregorioee542cc2006-11-16 04:43:19 +000089<dl><dt><b><tt id='l2h-24' xml:id='l2h-24' class="member">previous</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000090<dd>
91If redirects are followed then the <tt class="class">Response</tt> object returned
92is just for the very last HTTP request and <var>previous</var> points to
93the previous <tt class="class">Response</tt> object. In this manner they form a chain
94going back through the responses to the very first response.
95Will be <code>None</code> if there are no previous respones.
96</dl>
97
98<P>
jcgregorio772adc82006-11-17 21:52:34 +000099The Response object also populates the header <code>content-location</code>, that
jcgregoriof76c9512006-11-07 18:01:50 +0000100contains the URI that was ultimately requested. This is useful if
101redirects were encountered, you can determine the ultimate URI that
102the request was sent to. All Response objects contain this key value,
103including <code>previous</code> responses so you can determine the entire
104chain of redirects.
105
106<P>
jcgregorio26c0cd72006-07-03 17:36:17 +0000107
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>