blob: e3fbab43f5c729df6f994361149e16d5086a5f51 [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" />
jcgregorio88ada9a2007-05-03 13:20:38 +000013<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
jcgregorio26c0cd72006-07-03 17:36:17 +000014<meta name='aesop' content='information' />
15<title>1.1.3 Response Objects</title>
16</head>
17<body>
jcgregorio88ada9a2007-05-03 13:20:38 +000018<div class="navigation">
jcgregorio26c0cd72006-07-03 17:36:17 +000019<div id='top-navigation-panel' xml:id='top-navigation-panel'>
20<table align="center" width="100%" cellpadding="0" cellspacing="2">
21<tr>
jcgregorio88ada9a2007-05-03 13:20:38 +000022<td class='online-navigation'><a rel="prev" title="1.1.2 cache Objects"
jcgregorio26c0cd72006-07-03 17:36:17 +000023 href="cache-objects.html"><img src='previous.png'
jcgregorio88ada9a2007-05-03 13:20:38 +000024 border='0' height='32' alt='Previous Page' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +000025<td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive"
26 href="module-httplib2.html"><img src='up.png'
jcgregorio88ada9a2007-05-03 13:20:38 +000027 border='0' height='32' alt='Up one Level' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +000028<td class='online-navigation'><a rel="next" title="1.1.4 Examples"
29 href="httplib2-example.html"><img src='next.png'
jcgregorio88ada9a2007-05-03 13:20:38 +000030 border='0' height='32' alt='Next Page' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +000031<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'
jcgregorio88ada9a2007-05-03 13:20:38 +000034 border='0' height='32' alt='Contents' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +000035<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>
jcgregorio88ada9a2007-05-03 13:20:38 +000042<a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</a>
jcgregorio26c0cd72006-07-03 17:36:17 +000043<b class="navlabel">Up:</b>
jcgregorio88ada9a2007-05-03 13:20:38 +000044<a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</a>
jcgregorio26c0cd72006-07-03 17:36:17 +000045<b class="navlabel">Next:</b>
jcgregorio88ada9a2007-05-03 13:20:38 +000046<a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</a>
jcgregorio26c0cd72006-07-03 17:36:17 +000047</div>
48<hr /></div>
jcgregorio88ada9a2007-05-03 13:20:38 +000049</div>
jcgregorio26c0cd72006-07-03 17:36:17 +000050<!--End of Navigation Panel-->
51
jcgregorio88ada9a2007-05-03 13:20:38 +000052<h2><a name="SECTION002130000000000000000"></a>
53<a name="response-objects"></a>
54<br>
jcgregorio26c0cd72006-07-03 17:36:17 +0000551.1.3 Response Objects
jcgregorio88ada9a2007-05-03 13:20:38 +000056</h2>
jcgregorio26c0cd72006-07-03 17:36:17 +000057
jcgregorio88ada9a2007-05-03 13:20:38 +000058<p>
jcgregorio26c0cd72006-07-03 17:36:17 +000059Response objects are derived from <tt class="class">dict</tt> and map
60header names (lower case with the trailing colon removed)
61to header values. In addition to the dict methods
62a Response object also has:
63
jcgregorio88ada9a2007-05-03 13:20:38 +000064<p>
joe.gregorioab704ef2007-10-23 15:26:12 +000065<dl><dt><b><tt id='l2h-26' xml:id='l2h-26' class="member">fromcache</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000066<dd>
67If <code>true</code> the the response was returned from the cache.
68</dl>
69
jcgregorio88ada9a2007-05-03 13:20:38 +000070<p>
joe.gregorioab704ef2007-10-23 15:26:12 +000071<dl><dt><b><tt id='l2h-27' xml:id='l2h-27' class="member">version</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000072<dd>
73The version of HTTP that the server supports. A value
74of 11 means '1.1'.
75</dl>
76
jcgregorio88ada9a2007-05-03 13:20:38 +000077<p>
joe.gregorioab704ef2007-10-23 15:26:12 +000078<dl><dt><b><tt id='l2h-28' xml:id='l2h-28' class="member">status</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000079<dd>
80The numerical HTTP status code returned in the response.
81</dl>
82
jcgregorio88ada9a2007-05-03 13:20:38 +000083<p>
joe.gregorioab704ef2007-10-23 15:26:12 +000084<dl><dt><b><tt id='l2h-29' xml:id='l2h-29' class="member">reason</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000085<dd>
86The human readable component of the HTTP response status code.
87</dl>
88
jcgregorio88ada9a2007-05-03 13:20:38 +000089<p>
joe.gregorioab704ef2007-10-23 15:26:12 +000090<dl><dt><b><tt id='l2h-30' xml:id='l2h-30' class="member">previous</tt></b></dt>
jcgregorio26c0cd72006-07-03 17:36:17 +000091<dd>
92If redirects are followed then the <tt class="class">Response</tt> object returned
93is just for the very last HTTP request and <var>previous</var> points to
94the previous <tt class="class">Response</tt> object. In this manner they form a chain
95going back through the responses to the very first response.
96Will be <code>None</code> if there are no previous respones.
97</dl>
98
jcgregorio88ada9a2007-05-03 13:20:38 +000099<p>
jcgregorio772adc82006-11-17 21:52:34 +0000100The Response object also populates the header <code>content-location</code>, that
jcgregoriof76c9512006-11-07 18:01:50 +0000101contains the URI that was ultimately requested. This is useful if
102redirects were encountered, you can determine the ultimate URI that
103the request was sent to. All Response objects contain this key value,
104including <code>previous</code> responses so you can determine the entire
jcgregoriocde4f092007-03-08 21:59:04 +0000105chain of redirects. If <tt class="member">Http.force_exception_to_status_code</tt> is <code>True</code>
106and the number of redirects has exceeded the number of allowed number
107of redirects then the <tt class="class">Response</tt> object will report the error
108in the status code, but the complete chain of previous responses will
109still be in tact.
jcgregoriof76c9512006-11-07 18:01:50 +0000110
jcgregorio88ada9a2007-05-03 13:20:38 +0000111<p>
jcgregorio26c0cd72006-07-03 17:36:17 +0000112
jcgregorio88ada9a2007-05-03 13:20:38 +0000113<div class="navigation">
jcgregorio26c0cd72006-07-03 17:36:17 +0000114<div class='online-navigation'>
115<p></p><hr />
116<table align="center" width="100%" cellpadding="0" cellspacing="2">
117<tr>
jcgregorio88ada9a2007-05-03 13:20:38 +0000118<td class='online-navigation'><a rel="prev" title="1.1.2 cache Objects"
jcgregorio26c0cd72006-07-03 17:36:17 +0000119 href="cache-objects.html"><img src='previous.png'
jcgregorio88ada9a2007-05-03 13:20:38 +0000120 border='0' height='32' alt='Previous Page' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +0000121<td class='online-navigation'><a rel="parent" title="1.1 httplib2 A comprehensive"
122 href="module-httplib2.html"><img src='up.png'
jcgregorio88ada9a2007-05-03 13:20:38 +0000123 border='0' height='32' alt='Up one Level' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +0000124<td class='online-navigation'><a rel="next" title="1.1.4 Examples"
125 href="httplib2-example.html"><img src='next.png'
jcgregorio88ada9a2007-05-03 13:20:38 +0000126 border='0' height='32' alt='Next Page' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +0000127<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'
jcgregorio88ada9a2007-05-03 13:20:38 +0000130 border='0' height='32' alt='Contents' width='32' /></a></td>
jcgregorio26c0cd72006-07-03 17:36:17 +0000131<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>
jcgregorio88ada9a2007-05-03 13:20:38 +0000138<a class="sectref" rel="prev" href="cache-objects.html">1.1.2 Cache Objects</a>
jcgregorio26c0cd72006-07-03 17:36:17 +0000139<b class="navlabel">Up:</b>
jcgregorio88ada9a2007-05-03 13:20:38 +0000140<a class="sectref" rel="parent" href="module-httplib2.html">1.1 httplib2 A comprehensive</a>
jcgregorio26c0cd72006-07-03 17:36:17 +0000141<b class="navlabel">Next:</b>
jcgregorio88ada9a2007-05-03 13:20:38 +0000142<a class="sectref" rel="next" href="httplib2-example.html">1.1.4 Examples</a>
jcgregorio26c0cd72006-07-03 17:36:17 +0000143</div>
144</div>
145<hr />
jcgregoriocde4f092007-03-08 21:59:04 +0000146<span class="release-info">Release 0.3, documentation updated on Mar 8, 2007.</span>
jcgregorio88ada9a2007-05-03 13:20:38 +0000147</div>
jcgregorio26c0cd72006-07-03 17:36:17 +0000148<!--End of Navigation Panel-->
149
jcgregorio88ada9a2007-05-03 13:20:38 +0000150</body>
151</html>