from socketio import SimpleClient from json import dumps from datetime import datetime with open("logs.txt", "a") as fp: with SimpleClient() as sio: sio.connect("https://onemillioncheckboxes.com/socket.io") while True: event = sio.receive() now = datetime.utcnow() print(now, event) fp.write(str(now.timestamp()) + " " + dumps(event) + "\n")