I am building an application that requires the client ip for geolocation purposes. I am using python, flask, and nginx to serve. From what I have read, common ip address capturing happens in the actual server. Any python script I use inevitably just returns my servers ip. What is the best way to get a client's ip address and pass it to the python scripts for further work to be done?
Asked
Active
Viewed 105 times
1 Answers
-1
Although you're required to share part of your code to get help, I'm gonna answer your question: You can use Flask request.
from flask import request
...
client_ip = request.environ['REMOTE_ADDR']
client_port = request.environ['REMOTE_PORT']

Elie Saad
- 516
- 4
- 8