[python-advocacy] Python makes the "most wanted list"
facundobatista at gmail.com
Mon Feb 11 14:36:38 CET 2008
2008/2/9, Michael Pittaro <mikeyp at snaplogic.org>:
> We could probably update the urllib documentation to strongly encourage
> setting the User-agent header. The examples already show how to do it,
> but if urllib2.urlopen() is the popular function, adding useragent as
> an argument to might be worth considering.
Setting the useragent, as any header, is plain easy.
urllib2, right or wrong, has a minimalistic approach regarding the
headers (for example, you send a POST request, adding data to it, and
automatically it does not incorporate a Content-Length header.
urllib2.urlopen could grow an User-Agent header, to make user aware
that it's normally a "useful" header.
But, remember that this method is multiprotocol, it supports file://,
or ftp://, for example...
Focusing in usefulness, I'd prefer a "headers" argument, but that's me.
More information about the Advocacy