On Mon, Jan 4, 2010 at 1:10 AM, Alagu Madhu <[email protected]> wrote:
> Hi
>
> I try to get client IP using request.environ.get("REMOTE_ADDR"),it is
> working.But It is not working in website.

Try raising a RuntimeError in the controller, and in the interactive
traceback execute "
sorted(request.environ.keys())".  I did this and got the following.
Does yours look substantially different?

>>> sorted(request.environ.keys())
['CONTENT_LENGTH', 'CONTENT_TYPE', 'HTTP_ACCEPT',
'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT_ENCODING', 'HTTP_ACCEPT_LANGUAGE',
'HTTP_CONNECTION', 'HTTP_COOKIE', 'HTTP_HOST', 'HTTP_KEEP_ALIVE',
'HTTP_USER_AGENT', 'PATH_INFO', 'QUERY_STRING', 'REMOTE_ADDR',
'REMOTE_USER', 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME',
'SERVER_PORT', 'SERVER_PROTOCOL', 'beaker.cache',
'beaker.get_session', 'beaker.session', 'paste.evalexception',
'paste.evalexception.debug_count', 'paste.httpserver.thread_pool',
'paste.registry', 'paste.throw_errors', 'pylons.action_method',
'pylons.controller', 'pylons.environ_config', 'pylons.pylons',
'pylons.routes_dict', 'routes.route', 'routes.url',
'weberror.evalexception', 'webob._parsed_query_vars',
'webob.adhoc_attrs', 'wsgi.errors', 'wsgi.input', 'wsgi.multiprocess',
'wsgi.multithread', 'wsgi.run_once', 'wsgi.url_scheme',
'wsgi.version', 'wsgiorg.routing_args']
>>> request.environ["REMOTE_ADDR"]
'127.0.0.1'

-- 
Mike Orr <[email protected]>

--

You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.


Reply via email to