PyAMF: How do you get the client's ip address?

247 Views Asked by At

Is there anyway to get the client's ip address when running PyAMF via the WSGI gateway interface (Apache)?

1

There are 1 best solutions below

0
cwallenpoole On BEST ANSWER

It will be under the key REMOTE_ADDR in your server's request handler. For example, (from the Hello World script):

httpd = simple_server.WSGIServer(
    ('localhost', 8000),
    simple_server.WSGIRequestHandler,
)

def app(environ, start_response):
    # environ['REMOTE_ADDR'] is what you're looking for!
    pass

httpd.set_app(app)