Compare commits

..

No commits in common. "62c0fe857b8df62db7d7a49d09b55931dcffe6a8" and "72fb716199a03679cd2a1739cf3074a44195f956" have entirely different histories.

View File

@ -1,21 +1,18 @@
from flask import Flask, request, jsonify
from PIL import Image
import datetime
import config
app = Flask(__name__)
@app.route("/post_img", methods=["POST"])
def process_image():
if request.headers.get('Authorization') == 'Basic ' + config.api['key']:
file = request.files['image']
# Read the image via file.stream
img = Image.open(file.stream)
img = img.rotate(90, expand=True)
time = str(datetime.datetime.now().isoformat(timespec='minutes'))
img.save("./images/"+time+".jpg")
img.save("./images/"+time+".png")
return jsonify({'msg': 'success'})
else:
return jsonify({'msg': 'auth_fail'})
if __name__ == "__main__":
app.run(debug=True)