How to determine the final url after redirect using python / urllib2?

I need to get the final url after redirect in python.

What a good way to do this?

+4
source share
1 answer
>>> import urllib2 >>> var = urllib2.urlopen('http://www.stackoverflow.com/') >>> var.geturl() 'http://stackoverflow.com/' 
+8
source

Source: https://habr.com/ru/post/1303030/


All Articles