Python编程:flask_restful模块提供api接口

文档:https://flask-restful.readthedocs.io/en/latest/quickstart.html

安装

pip install flask-restful

代码示例

from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

class HelloWorld(Resource):
    def get(self):
        return {'hello': 'world'}

api.add_resource(HelloWorld, '/')

if __name__ == '__main__':
    app.run(debug=True)


上一篇:全方位挖掘大数据获取超额收益


下一篇:《编译与反编译技术实战》——1.4 编译器GCC