You get the IP address of your server, not the clients of your server.
You want to see the REMOTE_ADDR request, for example:
from bottle import Bottle, request app = Bottle() @app.route('/hello') def hello(): client_ip = request.environ.get('REMOTE_ADDR') return ['Your IP is: {}\n'.format(client_ip)] app.run(host='0.0.0.0', port=8080)
EDIT: Some people have noticed that for them, the value of REMOTE_ADDR is always the same IP address (usually 127.0.0.1 ). This is because they are behind the proxy (or load balancing). In this case, the source IP address of the client is usually stored in the HTTP_X_FORWARDED_FOR header. The following code will work anyway:
@app.route('/hello') def hello(): client_ip = request.environ.get('HTTP_X_FORWARDED_FOR') or request.environ.get('REMOTE_ADDR') return ['Your IP is: {}\n'.format(client_ip)]
source share