From 4a7b37bb816730010681fae0c31f454a29be98a3 Mon Sep 17 00:00:00 2001 From: Phin <59180111+phin05@users.noreply.github.com> Date: Fri, 18 Oct 2024 00:00:52 +0530 Subject: [PATCH] Debug logging for Imgur upload request --- core/imgur.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/imgur.py b/core/imgur.py index 82cddf8..b5011ab 100644 --- a/core/imgur.py +++ b/core/imgur.py @@ -17,11 +17,13 @@ def uploadToImgur(url: str) -> Optional[str]: newImage.thumbnail((maxSize, maxSize)) newImageBytesIO = io.BytesIO() newImage.save(newImageBytesIO, subsampling = 0, quality = 90, format = "JPEG") - data: models.imgur.UploadResponse = requests.post( + response = requests.post( "https://api.imgur.com/3/image", headers = { "Authorization": f"Client-ID {config['display']['posters']['imgurClientID']}" }, files = { "image": newImageBytesIO.getvalue() } - ).json() + ) + logger.debug("HTTP %d, %s, %s", response.status_code, response.headers, response.text.strip()) + data: models.imgur.UploadResponse = response.json() if not data["success"]: raise Exception(data["data"]["error"]) return data["data"]["link"]