diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-09-03 00:04:06 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-09-03 00:04:32 +0800 |
| commit | 8b609c545de168a912a897427f94588f57435a15 (patch) | |
| tree | 797852ce1b9aab728cbccd9f8704a6286e37cd75 | |
| parent | 1f5417927db7b0345b15702e6f8a4c3d8194b6ec (diff) | |
updated
modified: index.py
| -rw-r--r-- | index.py | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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) |
