Last Updated on November 30, 2019 by Christopher G Mendla
If you need to get the IP of a user, you can simply use request.remote.ip
ip = request.remote_ip
If you need to get the user browser, you can use the following
user_browser = request.env[‘HTTP_USER_AGENT’]
Of course, the results would be stored in ip and user_browser respectively.