import os import json def check_lead_existance(filepath: str)->bool: if os.path.isfile(filepath) and os.path.getsize(filepath): with open(filepath, 'r') as f: data = json.load(f)["companies"] if len(data) > 0: return True else: return False else: return False