How to obtain client ip address


Is it possible to find the client ip address in one of the http components?


Use environ['REMOTE_ADDR'] and environ['REMOTE_PORT'], although I don’t recall off the top of my head how those end up working when there are intermediaries between the client and server.


Works perfectly! Thanks…


How can I do this? thanks!

from apistar.server.wsgi import WSGIEnviron

def your_ip(environ: WSGIEnviron):
     return {"ip_addr": envrion["REMOTE_ADDR"]}