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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -