Skip to content

Instantly share code, notes, and snippets.

@pj8912
Created December 1, 2023 20:53
Show Gist options
  • Save pj8912/6336f7fa89086eb79e783f311a2c6fd3 to your computer and use it in GitHub Desktop.
Save pj8912/6336f7fa89086eb79e783f311a2c6fd3 to your computer and use it in GitHub Desktop.
Get IP address of visitors using Flask for Python
from flask import request
from flask import jsonify
@app.route("/get_my_ip", methods=["GET"])
def get_my_ip():
return jsonify({'ip': request.remote_addr}), 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment