urllib.urlretireve problem

Skip Montanaro skip at pobox.com
Wed Mar 30 19:03:18 EST 2005


    >> For example, for Temporary Name Resolution Failure, python raises an
    >> exception which I've handled well. The problem lies with obsolete
    >> urls where no exception is raised and I end up having a 404 error
    >> page as my data.

    Diez> It makes no sense having urllib generating exceptions for such a
    Diez> case. From its point of view, things work pefectly - it got a
    Diez> result. No network error or whatsoever.

You can subclass FancyURLOpener and define a method to handle 404s, 403s,
401s, etc.  There should be no need to resort to grubbing around with file
extensions and such.

Skip




More information about the Python-list mailing list