Using urllib to get the final redirect of a webpage in Python 3.5

Viewed 1668

As in this post, I attempt to get the final redirect of a webpage as:

import urllib.request
response = urllib.request.urlopen(url)
response.geturl()

But this doesn't work as I get the "HTTPError: HTTP Error 300: Multiple Choices" error when attempting to use urlopen.

See documentation for these methods here.

EDIT:

This problem is different than the Python: urllib2.HTTPError: HTTP Error 300: Multiple Choices question, because they skip the error-causing pages, while I have to obtain the final destination.

1 Answers
Related