Thanks that was just what I was looking for!

//Ed

On Feb 2, 6:16 am, "Brendan W. McAdams" <[EMAIL PROTECTED]> wrote:
> web.ctx.environ
> Contains the WSGI environment dictionary.  You should just need to import
> 'web' to get at it.
>
> Here's a sample dump from a request I just made:
>
> {'AUTH_TYPE': '', 'beaker.get_session': <bound method
> SessionMiddleware._get_session of
> <beaker.middleware.SessionMiddlewareobject at 0xd75fd0>>,
> 'SERVER_SOFTWARE': 'CherryPy/3.0.1 WSGI Server',
> 'SCRIPT_NAME': '', 'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1', 'REQUEST_METHOD':
> 'GET', 'PATH_INFO': '/', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '',
> 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_USER_AGENT':
> 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.8)
> Gecko/20071019 Firefox/2.0.0.8', 'HTTP_CONNECTION': 'keep-alive',
> 'REMOTE_PORT': '63671', 'SERVER_NAME': 'localhost', 'REMOTE_ADDR': '
> 192.168.0.240', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '8080', '
> wsgi.input': <socket._fileobject object at 0xf57960>, 'HTTP_HOST': '
> 192.168.0.59:8080', 'beaker.session': {}, 'wsgi.multithread': True,
> 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_ACCEPT':
> 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
> ,text/plain;q=0.8,image/png,*/*;q=0.5', 'wsgi.version': (1, 0), '
> wsgi.run_once': False, 'wsgi.errors': <open file '<stderr>', mode 'w' at
> 0x160b0>, 'wsgi.multiprocess': False, 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=
> 0.5', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_KEEP_ALIVE': '300'}
>
> I believe the HTTP_ACCEPT is what you're looking for.
>
> (FWIW, I produce the above dictionary by putting:
>
> print >> sys.stderr, `web.ctx.environ`
>
> Inside of my GET: method - that prints the environment out to the console.)
>
> On Feb 2, 2008 2:45 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm kinda new to web.py, and I've been looking for a way to get the
> > Accept header from the HTTP request. I see web.header can be used to
> > set headers in the response, but I can't seem to find a hook for
> > getting at HTTP headers in the request.
>
> > Can anyone point me in the right direction?
>
> > //Ed
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to webpy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to