Last active
September 26, 2016 13:59
-
-
Save pcote/7470be1631d060f1764140fa2dde568a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 request, abort | |
import model | |
@app.route("/save", methods=["POST"]) | |
def save_image(): | |
auth_data = request.authorization | |
user_name = auth_data.username | |
password = auth_data.password | |
if not model.is_password_valid(user_name, password, prehashed=True): | |
abort(401) | |
json_data = request.get_json() | |
drawing_name = json_data.get("drawingName") | |
pixel_data = json_data.get("drawingData") | |
model.save_drawing(drawing_name, user_name, pixel_data) | |
return "Save Successful" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment