CHAPTER 14 ■ HTTP WEB SERVICES
246
2. And here it is: status code 301. But again, notice what didn’t happen: there was
no request to the redirect URL. Why not? Because it’s already cached locally.
3. httplib2 followed the redirect right into its cache.
But wait! There’s more! Look at Listing 14-25.
Listing 14-25. Rerequesting a Permanently Redirected Resource
# continued from the previous example
>>> response2, content2 = h.request('http://diveintopython3.org/examples/feed-301.xml') (1)
>>> response2.fromcache (2)
True
>>> content2 == content (3)
True
1. Here’s the difference between temporary and permanent redirects: once
httplib2 follows a permanent redirect, all further requests for that URL will
transparently be rewritten to the target ...