@app.route('/ip')
def view_origin():
 return jsonify(origin=request.headers.get('X-Forwarded-For', request.remote_addr))

@ app . route ( '/ip' ) def view_origin ( ) : return jsonify ( origin = request . headers . get ( 'X-Forwarded-For' , request . remote_addr ) )
returns origin ip .