Created
December 1, 2023 20:53
-
-
Save pj8912/6336f7fa89086eb79e783f311a2c6fd3 to your computer and use it in GitHub Desktop.
Get IP address of visitors using Flask for Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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