Python, url from request
I am 开发者_如何转开发trying to get the url of the page I just fetched - as it can change after redirects...
opener = urllib2.build_opener(redirect_handler.MyHTTPRedirectHandler())
opener.addheaders = [('Accept-encoding', 'gzip')]
self.response = opener.open(url)
self.page_contents = self.response.read()
However, due to redirects sometimes the page I request isn't the page I get.... how can I get the final url - I have tried to find a param on the self.response and looking at the docs isn't helping....
Any pointers?
This is done with
self.response.geturl()
精彩评论