You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iTi-Flask/iti/applications/extensions/http.py

30 lines
852 B
Python

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from flask import request
from apiflask import Schema
from apiflask.fields import Integer, String, Field
class BaseResponse(Schema):
data = Field()
code = Integer()
message = String()
def init_http(app):
app.config["BASE_RESPONSE_SCHEMA"] = BaseResponse
app.config["BASE_RESPONSE_DATA_KEY"] = "data"
@app.before_request
def before_request():
# print("请求地址:" + str(request.path))
# print("请求方法:" + str(request.method))
# print("---请求headers--start--")
# print(str(request.headers).rstrip())
# print("---请求headers--end----")
# print("GET参数" + str(request.args))
# print("POST参数" + str(request.form))
url = request.path # 当前请求的URL
passUrl = ["/login"]
if url in passUrl:
pass