diff --git a/app.cpython-38.pyc b/app.cpython-38.pyc new file mode 100644 index 0000000..d395a69 Binary files /dev/null and b/app.cpython-38.pyc differ diff --git a/app.py b/app.py new file mode 100644 index 0000000..b4bb574 --- /dev/null +++ b/app.py @@ -0,0 +1,34 @@ +import os + +from flask import Flask, request, send_file +from flask_restful import Resource, Api, reqparse + +app = Flask(__name__) +api = Api(app) + +class ObjectStorage(Resource): + + # @app.route('/objects/', methods=['GET', 'POST', 'PUT']) + def put(self, object_name): + file = request.files['file'] + file.save(object_name) + return {'status': 'success'} + + # @app.route('/objects/', methods=['GET', 'POST', 'PUT']) + def get(self, object_name): + file = open(object_name, 'rb') + return send_file(file, mimetype='application/octet-stream') + + # @app.route('/objects/', methods=['GET', 'POST', 'PUT']) + def delete(self, object_name): + os.remove(object_name) + return {'status': 'success'} + +@app.route('/') +def hello_world(): # put application's code here + return 'Hello World!' + +api.add_resource(ObjectStorage, '/objects/') + +if __name__ == '__main__': + app.run() diff --git a/flaskProject1.iml b/flaskProject1.iml new file mode 100644 index 0000000..2484ca0 --- /dev/null +++ b/flaskProject1.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/misc.xml b/misc.xml new file mode 100644 index 0000000..b534b89 --- /dev/null +++ b/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/modules.xml b/modules.xml new file mode 100644 index 0000000..f116556 --- /dev/null +++ b/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file