[twill] setting HTTP headers
Titus Brown
titus at caltech.edu
Mon Jan 29 00:52:16 PST 2007
On Wed, Dec 20, 2006 at 03:28:54PM -0800, Shaun Walbridge wrote:
-> Hi list,
->
-> I'm currently using twill to build a basic Campfire API, and am quite
-> happy with its cookie and form handling. I's also like to set http
-> headers to my requests, is there an easy way to do this? With urllib2,
-> it'd be something like:
->
-> import urllib2
-> headers = {'X-Requested-With' : 'XMLHttpRequest'}
-> response = opener.open(urllib2.Request(url, data, headers))
->
-> Is there any easy way of wrapping twill to do the same thing?
Hi, Shaun,
in the latest development version, you can now use
>> add_extra_header X-Requested-With XMLHttpRequest
>> show_extra_headers
>> clear_extra_headers
Thanks for the suggestion!
cheers,
--titus
p.s. available at
http://darcs.idyll.org/~t/projects/twill-latest.tar.gz
More information about the twill
mailing list