adsl vsp拨号服务器关于server端设置 未完
from flask import Flask,request app = Flask(__name__) @app.route('/') def info(): return 'kanha!' @app.route('/ip') def ip(): ip = request.remote_addr
with open('ip.txt','w')as f:
f.witer(ip)
f.close()
return '{}'.format(ip)
@app.route('/get_ip')
def ip():
with open('ip.txt','r')as f:
ip = f.read().strip()
f.close()
return '{}'.format(ip)
@app.route('/useragent') def ua(): ua = request.headers.get('User-Agent') return 'ua {}'.format(ua) if __name__ == '__main__': app.run(host='0.0.0.0',port=5000,debug=True)
设置一个flask的web服务器,来获取get过来的请求,将get过来的请求ip保存并显示在get_ip的页面中
request.remote_addr 得到ip ,但是端口咋的还不晓得?