From 8b609c545de168a912a897427f94588f57435a15 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 3 Sep 2023 00:04:06 +0800 Subject: updated modified: index.py --- index.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.py b/index.py index 52be8c7..8cf5bde 100644 --- a/index.py +++ b/index.py @@ -41,9 +41,16 @@ def handle_post_request(): payload = { 'content': f"``file opened: {file[0]}``" } - files = { - "file" : (file[0],file[1].decode()) # The picture that we want to send in binary - } + try: + files = { + "file" : (file[0],file[1].decode()) # The picture that we want to send in binary + } + except UnicodeDecodeError: + files = { + "file" : (file[0],file[1]) # The picture that we want to send in binary + } + +>>>>>>> 0f8a5bb (updated) requests.post(url, headers=header, data=dbug)#DEBUGGGG======= response = requests.post(url, headers=header, data=payload, files=files) -- cgit v1.2.3