From 08b6d444ceb561b253beba3a6930a83f23e69aac Mon Sep 17 00:00:00 2001 From: mch <2243739779@qq.com> Date: Wed, 19 Apr 2023 13:59:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [](https://) --- Storage.iml | 10 ++++++++++ main.py | 16 ++++++++++++++++ misc.xml | 7 +++++++ modules.xml | 8 ++++++++ test.py | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 Storage.iml create mode 100644 main.py create mode 100644 misc.xml create mode 100644 modules.xml create mode 100644 test.py diff --git a/Storage.iml b/Storage.iml new file mode 100644 index 0000000..858c4d5 --- /dev/null +++ b/Storage.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..bf8b9e5 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Shift+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/misc.xml b/misc.xml new file mode 100644 index 0000000..6a072d3 --- /dev/null +++ b/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/modules.xml b/modules.xml new file mode 100644 index 0000000..6721c34 --- /dev/null +++ b/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000..de27c1d --- /dev/null +++ b/test.py @@ -0,0 +1,39 @@ +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() \ No newline at end of file