flask set ip address code example
Example 1: flask get ip address of request
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
Example 2: flask run on ip and port
app.run(host='0.0.0.0', port=80)