[BlueBream] getting request http headers ?!

Thierry Florac tflorac at ulthar.net
Sat Nov 16 10:17:33 CET 2013


Hi,

Le Sat, 16 Nov 2013 07:14:54 +0100,
  Tamer Higazi <th982a at googlemail.com> a écrit:

> Any ideas how to get the http headers of a request object ?!
> 
> I thought the Browser which send the headers to the server are stored
> in:
> 
> self.request.headers which return me only a:
> <zope.publisher.http.HeaderGetter object at 0x26d97d0>
> 
> for any advises I would thank you.

Did you try :
    request.getHeader('Accept-Language') ?
or
    request.headers.get('Accept-Language') ?
or
    request.headers['Accept-Language'] ?

The last one may raise an exception if given header is not available,
while other ones will only return None (by default).

As far as I know, you can't get an enumeration of all headers which are
available in the HTTP request, you have to know which headers you are
looking for...

Regards,
Thierry


More information about the bluebream mailing list