urllib2 compose header

Pigio® eviola at dsi.unive.it
Thu Dec 12 12:59:47 EST 2002


Inside Python's italian manual there is next example:

MyRequest=urllib2.Request("http://www.python.org")
MyRequest=add.header('user-agent','Testing 1 2 3')
URL=urllib2.urlopen(MyRequest)

In this case the user-agent header field is sets.
I set Accept header field with next mode:
MyRequest=add.header(accept','text/html') and I request resource type
'image/jpg'.
In this case, remote web service must replies code  406, but happen that
returned code  is 200 and it also sends  the resource. WHAT'S HAPPEN?





More information about the Python-list mailing list