to folder

This commit is contained in:
ovosimpatico
2023-10-10 18:35:30 -03:00
parent 663c3f2a98
commit bfb6102d2b

View File

@@ -4,9 +4,9 @@ import json
from colr import color from colr import color
def on_message(ws, message): def on_message(ws, message):
print("Data received! Writing it to a file") print("Data received!")
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
filename = f"websocket_{timestamp}.dict" filename = f"data/websocket_{timestamp}.dict"
with open(filename, "w") as file: with open(filename, "w") as file:
file.write(message) file.write(message)