Exemple #1
0
def api_config_post():
    args = request.form
    name = args["name"]
    api = args["api"]
    token = args["token"]
    config = Config.query.get(1)
    if not config:
        config = Config(name, api, token)
        db.session.add(config)
        db.session.commit()
    config.name = name
    config.api = api
    config.token = token
    db.session.commit()
    return jsonify({"message": "OK."}), 200