Ensure space launch JSON can be parsed before saving
This commit is contained in:
parent
566b09f888
commit
6d65f5045e
|
@ -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"]]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue