From 44357d6e6b4f9f7483d4ebfc7226c3b22605f627 Mon Sep 17 00:00:00 2001 From: niklas Date: Fri, 18 Sep 2020 17:49:19 +0200 Subject: "works" --- main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index ecb649a..4ba4aea 100755 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import os import sys +import uuid import base64 import getopt import requests @@ -58,12 +59,14 @@ def handle_replies(replies): elif a_type == "attachment": [file_name, file_type, file_content] = a_extra.split(';') try: - tmp_path = tempfile.TemporaryDirectory() + tmp_path = "/tmp/" + str(uuid.uuid1()) + os.mkdir(tmp_path) + # hack, do clean file_content = base64.b64decode(file_content) - file_path = tmp_path.name + '/' + file_name + file_path = tmp_path + '/' + file_name with open(file_path, "wb") as f: f.write(file_content) - return answer, True + return file_path, True except Exception as e: print(str(e)) answer += l_answer -- cgit v1.2.3-54-g00ecf