[BlueBream] getting request http headers ?!

Marius Gedminas marius at gedmin.as
Sat Nov 16 11:16:48 CET 2013


On Sat, Nov 16, 2013 at 12:12:58PM +0200, Marius Gedminas wrote:
> On Sat, Nov 16, 2013 at 07:14:54AM +0100, Tamer Higazi wrote:
> > Hi people!
> > 
> > Any ideas how to get the http headers of a request object ?!
> 
> AFAICT the only way is

The only way to *enumerate*, that his.  request.getHeader() is obviously
better if you already know which header you want.

> 
>   [(k, v) for k, v in request.environment.items() if k.startswith('HTTP_')]

Marius Gedminas
-- 
MPEG-1 Audio Layer 3 is colloquially known as “MP3.” If you haven’t heard of
MP3s, I don’t know what to do with you. Walmart sells portable music players
and calls them “MP3 players.” WALMART. Anyway…
        -- Mark Pilgrim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/bluebream/attachments/20131116/444a434e/attachment.sig>


More information about the bluebream mailing list