def http_redirect(self, req, fp, code, msg, hdrs): to = hdrs['Location'] h = urllib2.HTTPRedirectHandler() r = h.redirect_request(req, fp, code, msg, hdrs, to) return embedopen.open(r)