Initial Flask version
This commit is contained in:
commit
25bc373a3e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/venv/
|
23
api.py
Normal file
23
api.py
Normal file
@ -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)
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Flask==0.11.1
|
||||||
|
Flask-RESTful==0.3.5
|
Loading…
Reference in New Issue
Block a user