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