From 6d65f5045e2de9d644c9caa877e4781eb557b522 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 21 Jan 2024 08:07:11 +0000 Subject: [PATCH] Ensure space launch JSON can be parsed before saving --- agenda/thespacedevs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agenda/thespacedevs.py b/agenda/thespacedevs.py index 130be2f..18a5bbb 100644 --- a/agenda/thespacedevs.py +++ b/agenda/thespacedevs.py @@ -21,8 +21,8 @@ def next_launch_api(rocket_dir: str, limit: int = 200) -> list[Launch]: params: dict[str, str | int] = {"limit": limit} r = requests.get(url, params=params) - open(filename, "w").write(r.text) data = r.json() + open(filename, "w").write(r.text) return [summarize_launch(launch) for launch in data["results"]]