From 25bc373a3ecce261b53f228a99dc2e0f3682c570 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 25 Oct 2016 18:14:11 +0200 Subject: [PATCH] Initial Flask version --- .gitignore | 1 + api.py | 23 +++++++++++++++++++++++ requirements.txt | 2 ++ 3 files changed, 26 insertions(+) create mode 100644 .gitignore create mode 100644 api.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f21b54 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/venv/ diff --git a/api.py b/api.py new file mode 100644 index 0000000..076df65 --- /dev/null +++ b/api.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 + +from flask import Flask +from flask_restful import Resource, Api, reqparse + +app = Flask(__name__) +api = Api(app) + +parser = reqparse.RequestParser() +parser.add_argument('task') + +class HelloWorld(Resource): + def get(self): + return {"hello": "world"} + + def post(self): + print(parser.parse_args()) + return {'hello': 'world'} + +api.add_resource(HelloWorld, '/') + +if __name__ == '__main__': + app.run(debug=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..33ca2e1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Flask==0.11.1 +Flask-RESTful==0.3.5