[Tutor] dealing with 406 HTTP response
dyoo at hkn.eecs.berkeley.edu
Wed Jan 17 00:52:50 CET 2007
On Tue, 16 Jan 2007, Tsila Hassine wrote:
> has anybody dealt with a 406 reponse through a urllib.FancyURLopener
> class ? I have a code that downloads images from websites and soemsites
> respond with an 406 which I don't know how to handle
Have you looked at the description of a 406 error?
What's going on is that FancyURLOpener doesn't specify the types it can
accept, so by default, the types of things are quite limited.
You'll want to look into the addheader() method of your FancyURLOpener to
reassure the web server that you will accept anything from them, by adding
a permissive Accept: header. For example:
should add a 'Accept:' header that eats everything.
But for some reason, it appears that this method isn't documented in the
does anyone know what's going on there? Documentation on addheader can be
but the method should really be included in the API docs.
I'll send a ping to the Documentation folks and see if this will be
More information about the Tutor