Not able to extract the client ip using sanic

Hi Guys

I tried to extract the client IP via implementing the custom action but as the server runs on my machine, It ended up fetching the server IP.

I looked into sanic documentation to extract the client IP, but not able to extract it.

  from sanic.response import JSON

@app.route("/json")
def post_json(request):
  return json({ "received": True, "message": request.json })

Another method that I’m considering is

client_ip = request.headers.get('x-real-ip')

The end goal is to extract the IP of the requester and find out the geographical location on the basis of lat long and serve the user appropriately as per his location.

@anuragchaudhary did you get solution for this?

No, but got know two things , rasa is a server side application.

  1. The client ip can only be extracted by the client application.
  2. Then only we can pass the ip to rasa.