import json

from flask import request,Flask, jsonify
import redis

redis_client = redis.Redis(host='172.16.0.24', port=6379,db=8, password='aiyingli@@123', socket_timeout=10,decode_responses=True)

app = Flask(__name__)


@app.route('/dso/video_gen', methods=['POST'])
def video_gen():
    data = request.get_json()
    redis_client.lpush('dso_video_gen', json.dumps(data))
    return jsonify({
        "code": 200,
        "data":'',
        "msg": "数据接收成功"
    })


@app.route('/dso/image_gen', methods=['POST'])
def image_gen():
    data = request.get_json()
    redis_client.lpush('dso_image_gen', json.dumps(data))
    return jsonify({
        "code": 200,
        "data":'',
        "msg": "数据接收成功"
    })


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8086, debug=True)