开发者

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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜