from flask import Flask, request, send_file from flask_restful import Resource, Api, reqparse import os app = Flask(__name__) api = Api(app) app = Flask(__name__) api = Api(app) class ObjectStorage(Resource): def put(self, object_name): file = request.files['file'] file.save(object_name) return {'status': 'success'} def get(self, object_name): file = open(object_name, 'rb') return send_file(file, mimetype='application/octet-stream') def delete(self, object_name): os.remove(object_name) api.add_resource(ObjectStorage,'/objects/') @app.route("/") def hello(): return "Hello World!" @app.route("/1") def hello2(): return "Hello aaaaa World!" if __name__ == "__main__": app.run()