[Twisted-Python] twisted.web2's equivalent to setHeader?

Cameron Dale camrdale at gmail.com
Thu Apr 24 09:20:48 MDT 2008


On 4/24/08, inhahe <inhahe at gmail.com> wrote:
>             ctx.setHeader("Server", "Apache/2.2.8(Unix)")
>         exceptions.AttributeError: 'Request' object has no attribute
> 'setHeader'
>
> so how do I set a header using web2?

Try ctx.headers.setHeader(). web2 requests have a headers attribute of
this class:

http://twistedmatrix.com/documents/2.5.0/api/twisted.web2.http_headers.Headers.html

Cameron




More information about the Twisted-Python mailing list