diff options
author | niklas <niklas@niklashalle.net> | 2020-09-18 17:49:19 +0200 |
---|---|---|
committer | niklas <niklas@niklashalle.net> | 2020-09-18 17:49:19 +0200 |
commit | 44357d6e6b4f9f7483d4ebfc7226c3b22605f627 (patch) | |
tree | 651a7b257b1f74242dcfc790c33f676ab33174a6 /main.py | |
parent | 9a5693bb5dcf70bfaa06504211055a32c9b830b2 (diff) | |
download | n_frontend_signal-44357d6e6b4f9f7483d4ebfc7226c3b22605f627.tar.gz n_frontend_signal-44357d6e6b4f9f7483d4ebfc7226c3b22605f627.zip |
"works"
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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 |