HTTPError sometimes when using urllib2.urlopen

Magnus.Moraberg at gmail.com Magnus.Moraberg at gmail.com
Tue May 27 05:03:02 EDT 2008


Hi,

I have the following code -

import urllib2
from BeautifulSoup import BeautifulSoup

proxy_support = urllib2.ProxyHandler({"http":"http://
999.999.999.999:8080"})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)

page = urllib2.urlopen('http://www.cornish-language.org/CORNISH/
membership.asp')
soup = BeautifulSoup(page)

pageText = soup.findAll(text=True)
print pageText

Sometimes when I run this code I get the exception -

HTTPError: HTTP Error 407 Proxy authentication required

I seem to get this error repeatidly for a while, then I go a surf for
a moment and when I run the code again the exception might have gone
away. No idea why...

I have no problems with firefox which uses the same proxy. The proxy
requires no authentication...

What might the issue be?

Thanks,

Barry.





More information about the Python-list mailing list