一个简单的Flask例子

1、安装Flask

pip install Flask

 

from flask import Flask
app = Flask(__name__)
@app.route("/index1")
def hello():
return "hello world!"

@app.route("/python")
def python():
return "hello python!"

if __name__ == "__main__":
app.run()


2、request 调用
x=requests.get('http://127.0.0.1:5000/index1')

print(x.text)
posted @ 2023-01-31 16:14  测试的小七七  阅读(32)  评论(0编辑  收藏  举报