#!/usr/bin/env python3
""" This is a test script that saves leader status to json file every second"""
import json
import time


def update_leader_status():
    while True:
        data = {"status": "READY", "timestamp": int(time.time())}
        with open(
            "/competition/leader_node_status.json",
            "w",
        ) as statusfile:
            statusfile.write(json.dumps(data))
        time.sleep(1)

if __name__ == "__main__":
    update_leader_status()
