return infourl
http_error_300 = http_error_302
http_error_301 = http_error_302
http_error_303 = http_error_302
http_error_307 = http_error_302
opener = urllib.request.build_opener(NoRedirectHandler())
urllib.request.install_opener(opener)
response = urllib.request.urlopen('http://google.com')
if response.code in (300, 301, 302, 303, 307):
    pass
how to check if the urllib2 follow a redirect?