Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
adriankeenan committed Dec 30, 2024
1 parent 8f822c7 commit 300fca7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def get_last_set_image() -> Response | tuple[Response, int]:
@app.route("/", methods=['POST'])
def show_image() -> tuple[Response, int]:
try:
img_file = request.files['image'].stream
image = Image.open(img_file)
img_file = request.files['image']
image = Image.open(img_file.stream)
except UnidentifiedImageError:
return jsonify(message='"image" does not appear to be valid'), 422
except Exception as e:
Expand Down Expand Up @@ -69,7 +69,10 @@ def show_image() -> tuple[Response, int]:

loc = locals()
image_settings = {i: loc[i] for i in ('mode', 'dither', 'rotate', 'resize', 'background')}
image_settings['image'] = img_file.filename
image_settings['image_resolution'] = [image.width, image.height]
logging.debug(f'Creating an image with the following settings: {json.dumps(image_settings)}')

image_to_display = resize_img(image, dither, rotate, resize, background, DISPLAY_RESOLUTION)

try:
Expand Down

0 comments on commit 300fca7

Please sign in to comment.