删除 'test.py'

This commit is contained in:
mch 2023-04-19 14:02:20 +08:00
parent 5bc071d25b
commit f457d75335
1 changed files with 0 additions and 39 deletions

39
test.py
View File

@ -1,39 +0,0 @@
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/<string:object_name>')
@app.route("/")
def hello():
return "Hello World!"
@app.route("/1")
def hello2():
return "Hello aaaaa World!"
if __name__ == "__main__":
app.run()