urllib - changing the user agent
Terry Carroll
carroll at tjc.com
Fri Jan 9 14:30:42 EST 2004
On 9 Jan 2004 05:09:41 -0800, michael at foord.net (Fuzzyman) wrote:
[ wants to change the user-agent in HTTP request from urllib ]
Fuzzy --
I take the easy way out, and use urllib2, instead:
url = "http//www.spam.com/eggs.html"
req_headers = {
'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
}
req = urllib2.Request(url, None, req_headers)
More information about the Python-list
mailing list