urllib + headers
Andy Gimblett
gimbo at ftech.net
Wed Apr 24 05:26:38 EDT 2002
On Wed, Apr 24, 2002 at 11:52:26AM +0200, eli li wrote:
> I open url with urllib.urlopen, open method is POST. How is it
> possible in request to specify headers like 'Referer',
> 'Accept-Language', etc?
Don't use urllib.urlopen() :-)
Using urllib2, create a urllib2.Request object, call its add_header()
method to add the headers, then pass the object to urllib2.urlopen()
Hope this helps,
Andy
--
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.
More information about the Python-list
mailing list