Skip to content Skip to sidebar Skip to footer

Python Mechanize Won't Open These Sites

I'm working with Python's Mechanize module. I've come across 3 different sites that cannot be opened by mechanize directly: en.wikipedia.org/wiki/Dog (new user, can't post more th

Solution 1:

In the case of the cpsc.gov site, it looks like there's a refresh header that isn't being correctly processed by mechanize HTTPRefreshProcessor. However, you can workaround the problem as follows:

import mechanize

url = 'http://www.cpsc.gov/cpscpub/prerel/prhtml03/03059.html'
br = mechanize.Browser()
br.set_handle_refresh(False)
br.open(url)

Post a Comment for "Python Mechanize Won't Open These Sites"