先安装flask模块
pip install Flask
py文件
from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/hello_world') def hello_world(): return 'Hello World222' @app.route('/testGet',methods=["GET"]) def testGet (): print(request) id = request.args.get("id") return{"id":id} if __name__ == '__main__': app.run(host='0.0.0.0',port=1007,debug=True)
request.args.get("id")可以获取接口穿过来的参数
postman testGet请求
控制台
标签:__,testGet,python,app,request,接口,Flask,api,id From: https://www.cnblogs.com/bisiyuan/p/17086848.html