-
플라스크(Flask)에서 클라이언트(client) IP 확인Python/Flask 2019. 8. 27. 10:02반응형This file contains 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 Flask, request, jsonify app = Flask(__name__) @app.route('/ip', methods=['GET']) def name(): return request.environ.get('HTTP_X_REAL_IP', request.remote_addr) #return jsonify({'ip': request.remote_addr}), 200 #return jsonify({'ip': request.environ['REMOTE_ADDR']}), 200 if __name__ == '__main__': app.run(host='0.0.0.0', port=80) 반응형