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.