Not able to extract the client ip using sanic - Rasa Open Source - Rasa Community Forum

šŸ‘‹ Introducing the Rasa Playground

Not able to extract the client ip using sanic

post by anuragchaudhary on Jun 6, 2020

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.

Me too

542 views

post by lelemh on Aug 17, 2020

@anuragchaudhary did you get solution for this?

post by anuragchaudhary on Aug 17, 2020

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.