Catch and ignore space launch API errors

This commit is contained in:
Edward Betts 2024-07-09 08:22:33 +01:00
parent 0c36591e2f
commit d1898686e9
2 changed files with 11 additions and 3 deletions

View file

@ -114,6 +114,7 @@ def update_thespacedevs(config: flask.config.Config) -> None:
rocket_dir = os.path.join(config["DATA_DIR"], "thespacedevs")
existing_data = agenda.thespacedevs.load_cached_launches(rocket_dir)
assert existing_data
prev_launches = {
slug: get_launch_by_slug(existing_data, slug)
for slug in config["FOLLOW_LAUNCHES"]
@ -121,6 +122,8 @@ def update_thespacedevs(config: flask.config.Config) -> None:
t0 = time()
data = agenda.thespacedevs.next_launch_api_data(rocket_dir)
if not data:
return # thespacedevs API call failed
cur_launches = {
slug: get_launch_by_slug(data, slug) for slug in config["FOLLOW_LAUNCHES"]
}