1from flask import Flask, request, jsonify2 3app = Flask(__name__)4 5@app.route("/ip", methods=["GET"])6def ip():7 """返回访问 IP"""8 return jsonify(origin=request.headers.get('X-Forwarded-For', request.remote_addr))