Renamed Response._previous to Response.previous
diff --git a/CHANGELOG b/CHANGELOG
index 4e3b57b..53d32ac 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,12 @@
+0.2.0
+ Added support for Google Auth.
+ Added support for a pluggable caching system. Now supports
+ the file system and memcached.
+ Added experimental support for HMACDigest.
+
+ Added httplib2.debuglevel which turns on debugging.
0.1.1
diff --git a/README b/README
index f1b0a22..9815ab0 100644
--- a/README
+++ b/README
@@ -31,7 +31,7 @@
Redirects
Automatically follows 3XX redirects on GETs.
Compression
- Handles both 'compress' and 'gzip' types of compression.
+ Handles both 'deflate' and 'gzip' types of compression.
Lost update support
Automatically adds back ETags into PUT requests to resources i
we have already cached. This implements Section 3.2 of
diff --git a/httplib2/__init__.py b/httplib2/__init__.py
index 0d8a867..661c927 100644
--- a/httplib2/__init__.py
+++ b/httplib2/__init__.py
@@ -10,7 +10,9 @@
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
-__contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)"]
+__contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)",
+ "James Antill",
+ "Xavier Verges Farrero"]
__license__ = "MIT"
__version__ = "$Rev$"
@@ -634,7 +636,7 @@
location = urlparse.urljoin(absolute_uri, location)
redirect_method = ((response.status == 303) and (method not in ["GET", "HEAD"])) and "GET" or method
(response, content) = self.request(location, redirect_method, body=body, headers = headers, redirections = redirections - 1)
- response._previous = old_response
+ response.previous = old_response
else:
raise RedirectLimit( _("Redirected more times than rediection_limit allows."))
elif response.status in [200, 203] and method == "GET":
@@ -703,8 +705,8 @@
if info.has_key('-x-permanent-redirect-url'):
# Should cached permanent redirects be counted in our redirection count? For now, yes.
(response, new_content) = self.request(info['-x-permanent-redirect-url'], "GET", headers = headers, redirections = redirections - 1)
- response._previous = Response(info)
- response._previous.fromcache = True
+ response.previous = Response(info)
+ response.previous.fromcache = True
else:
# Determine our course of action:
# Is the cached entry fresh or stale?
@@ -777,20 +779,20 @@
"""Reason phrase returned by server."""
reason = "Ok"
- _previous = None
+ previous = None
def __init__(self, info):
# info is either an rfc822.Message or
# an httplib.HTTPResponse object.
if isinstance(info, httplib.HTTPResponse):
- for key, value in info.getheaders(): # This is where the 2.4 requirement comes from
+ for key, value in info.getheaders():
self[key] = value
self.status = info.status
self['status'] = str(self.status)
self.reason = info.reason
self.version = info.version
elif isinstance(info, rfc822.Message):
- for key, value in info.items(): # This is where the 2.4 requirement comes from
+ for key, value in info.items():
self[key] = value
self.status = int(self['status'])
diff --git a/httplib2test.py b/httplib2test.py
index 4bf1278..fc969de 100755
--- a/httplib2test.py
+++ b/httplib2test.py
@@ -66,7 +66,7 @@
uri = urlparse.urljoin(base, "304/test_etag.txt")
(response, content) = http.request(uri, "GET")
self.assertEqual(response.status, 200)
- self.assertEqual(response._previous, None)
+ self.assertEqual(response.previous, None)
def testGetOnlyIfCachedCacheMiss(self):
# Test that can do a GET with no cache with 'only-if-cached'
@@ -107,15 +107,15 @@
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 300)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 300)
+ self.assertEqual(response.previous.fromcache, False)
# Confirm that the intermediate 300 is not cached
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 300)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 300)
+ self.assertEqual(response.previous.fromcache, False)
def testGet300WithoutLocation(self):
# Not giving a Location: header in a 300 response is acceptable
@@ -124,7 +124,7 @@
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 300)
self.assertTrue(response['content-type'].startswith("text/html"))
- self.assertEqual(response._previous, None)
+ self.assertEqual(response.previous, None)
def testGet301(self):
# Test that we automatically follow 301 redirects
@@ -133,14 +133,14 @@
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 301)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 301)
+ self.assertEqual(response.previous.fromcache, False)
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 301)
- self.assertEqual(response._previous.fromcache, True)
+ self.assertEqual(response.previous.status, 301)
+ self.assertEqual(response.previous.fromcache, True)
def testGet302(self):
# Test that we automatically follow 302 redirects
@@ -149,16 +149,16 @@
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 302)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 302)
+ self.assertEqual(response.previous.fromcache, False)
uri = urlparse.urljoin(base, "302/onestep.asis")
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(response.fromcache, True)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 302)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 302)
+ self.assertEqual(response.previous.fromcache, False)
uri = urlparse.urljoin(base, "302/twostep.asis")
@@ -166,8 +166,8 @@
self.assertEqual(response.status, 200)
self.assertEqual(response.fromcache, True)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 302)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 302)
+ self.assertEqual(response.previous.fromcache, False)
def testGet302RedirectionLimit(self):
# Test that we can set a lower redirection limit
@@ -198,13 +198,13 @@
# Google always redirects to http://google.com
(response, content) = self.http.request("https://google.com", "GET")
self.assertEqual(200, response.status)
- self.assertEqual(302, response._previous.status)
+ self.assertEqual(302, response.previous.status)
def testGetViaHttps(self):
# Test that we can handle HTTPS
(response, content) = self.http.request("https://google.com/adsense/", "GET")
self.assertEqual(200, response.status)
- self.assertEqual(None, response._previous)
+ self.assertEqual(None, response.previous)
def testGetViaHttpsSpecViolationOnLocation(self):
# Test that we follow redirects through HTTPS
@@ -213,7 +213,7 @@
# absolute one.
(response, content) = self.http.request("https://google.com/adsense", "GET")
self.assertEqual(200, response.status)
- self.assertNotEqual(None, response._previous)
+ self.assertNotEqual(None, response.previous)
def testGet303(self):
# Do a follow-up GET on a Location: header
@@ -222,7 +222,7 @@
(response, content) = self.http.request(uri, "POST", " ")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 303)
+ self.assertEqual(response.previous.status, 303)
def test303ForDifferentMethods(self):
# Test that all methods can be used
@@ -286,15 +286,15 @@
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 307)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 307)
+ self.assertEqual(response.previous.fromcache, False)
(response, content) = self.http.request(uri, "GET")
self.assertEqual(response.status, 200)
self.assertEqual(response.fromcache, True)
self.assertEqual(content, "This is the final destination.\n")
- self.assertEqual(response._previous.status, 307)
- self.assertEqual(response._previous.fromcache, False)
+ self.assertEqual(response.previous.status, 307)
+ self.assertEqual(response.previous.fromcache, False)
def testGet410(self):
# Test that we pass 410's through
diff --git a/index.html b/index.html
index afa0369..64ffe8d 100644
--- a/index.html
+++ b/index.html
@@ -49,7 +49,7 @@
<dd>Automatically follows 3XX redirects on GETs.</dd>
<dt>Compression</dt>
- <dd>Handles both 'compress' and 'gzip' types of compression.</dd>
+ <dd>Handles both 'deflate' and 'gzip' types of compression.</dd>
<dt>Lost update support</dt>
<dd>Automatically adds back ETags into PUT requests to resources
@@ -169,7 +169,10 @@
Thomas Broyer (t.broyer@ltgt.net)
</dd>
<dd>
- (Your name here)
+ James Antill
+ </dd>
+ <dd>
+ Xavier Verges Farrero
</dd>
</dl>
</p>