Created
January 9, 2016 17:21
-
-
Save michaelkuty/16203266f5d0bbe54f0e to your computer and use it in GitHub Desktop.
Salt Master Flask server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import jsonify | |
from flask import Flask | |
from flask import request | |
import yaml | |
app = Flask(__name__) | |
@app.route("/<path:path>", methods=['POST']) | |
def dump_relass(path): | |
print path | |
reclass = yaml.load(request.data) | |
print reclass | |
stream = file('/' + path, 'w') | |
yaml.dump(reclass, stream) | |
stream.close() | |
return jsonify({"result": "Success! See /%s" % path}) | |
if __name__ == "__main__": | |
app.debug = True | |
app.run(host="0.0.0.0") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment