获取ip
import request
ip = request.remote_addr
获取时间
from datetime import datetime
current_time = datetime.now()
Request
method
起始行,元数据host
起始行,元数据path
起始行,元数据environ
其中的SERVER_PROTOCOL
是起始行,元数据headers
头,元数据data
body, 元数据remote_addr
客户端地址args
请求链接中的参数(GET 参数),解析后form
form 提交中的参数,解析后values
args 和 form 的集合json
json 格式的 body 数据,解析后cookies
指向 Cookie 的链接
ip = request.remote_addr print('当前IP为:', ip, '当前时间为:', datetime.now()) print('当前浏览器为:',request.headers.get('User-Agent')) print('当前请求方式为:',request.method) print('当前地址为:',request.host)