urllib: http error codes

Patrick Useldinger p at trick.lu
Thu Dec 18 16:02:59 EST 2003


Ok, found it myself...

class MyURLopener(urllib.FancyURLopener):
    def http_error_default(self, url, fp, errcode, errmsg, headers):
        void = fp.read()
        fp.close()
        raise IOError, ('http error', errcode, errmsg, headers)   
urllib._urlopener = MyURLopener()


--
http://www.homepages.lu/pu/




More information about the Python-list mailing list