redirect - Redirection url using urllib in Python 3 -
i need know final url when following redirections using urllib in python 3.
let's i've code :
opener = urllib.request.build_opener() request = urllib.request.request(url) u = opener.open(request) if urls redirects website, how can know new website url ? i've found nothing useful in documentation.
thanks !
you can use
u.geturl() to url redirected (or original 1 if no redirect happened).
Comments
Post a Comment