"""Harbor invokes this inside the puzzle service after stopping the agent.""" import json import pathlib import urllib.request with urllib.request.urlopen("http://127.0.0.1:8000/state", timeout=10) as response: state = json.load(response) state["collected_from_live_service"] = True target = pathlib.Path("/evidence/final.json") temp = target.with_suffix(".tmp") temp.write_text(json.dumps(state)) temp.replace(target)