Hi,

i have the following code to load a url.
My question is what if I try to load an invalide url ("http://
www.heise.de/"), will I get an IOException? or it will wait forever?

Thanks for any help.

 opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    urllib2.install_opener(opener)

    txheaders = {'User-agent': 'Mozilla/5.0 (X11; U; Linux i686; en-
US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3'}

    try:
        req = Request(url, txdata, txheaders)
        handle = urlopen(req)
    except IOError, e:
        print e
        print 'Failed to open %s' % url
        return 0;

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to