I am trying to follow the redirect of a url using urllib2.
>>> import urllib2
>>> page=urllib2.urlopen('http://acer.com')
>>> print page.geturl()
http://www.acer.com/worldwide/selection.html
>>>page=urllib2.urlopen('http://www.acer.com/worldwide/selection.html')
>>> print page.geturl()
http://www.acer.com/worldwide/selection.html
But when I open http://www.acer.com/worldwide/selection.html
in my browser it redirects to http://us.acer.com/ac/en/US/content/home#_ga=1.216787925.232352975.1435019296
How to detect this redirection using urllib.
get_url()
doesn't work for all re-directs (for example JavaScript redirects)What are you trying to achieve?
Something like Selenium with PhantomJS as the backend might be more suited to this.
For screenshots you can then use
save_screenshot()
which is part of Selenium Webdriver