index.py 1.04 KB
from flask import Flask, request
from flask_restplus import Resource, Api, fields

import process

app = Flask(__name__, static_url_path='/static')
api = Api(app, version='1.0', title='FlaskLocal', description='FlaskLocal')

ns_node = api.namespace('node', description='node API')
node_response = ns_node.model("test_response",{
    "unknown_person": fields.Boolean,
    "fire_broken" : fields.Boolean
})

node_request = ns_node.model('test_request', {
    'data': fields.String
})

#앱빌더를 통해 새 게시물 & 댓글 알림 수신
@ns_node.route('/process')
class test(Resource):
    @ns_node.doc('post')
    @ns_node.expect(node_request)
    #@ns_node.marshal_with(node_response)
    def post(self):
        print(api)
        print(api.payload)
        #res = node.ProcessImage(api.payload)
        #return res

@app.route('/process', methods=['POST'])
def post():
    #print(request.form)
    res = node.ProcessImage(request.form)
    return res

if __name__ == '__main__':
    node = process.Process()
    app.run(host='0.0.0.0', port=80, threaded=False)