Add filters for space launches

This commit is contained in:
Edward Betts 2024-07-01 22:27:19 +03:00
parent c41bcc3304
commit b65d79cb63
3 changed files with 66 additions and 6 deletions

View file

@ -136,7 +136,7 @@ def summarize_launch(launch: Launch) -> Summary:
"launch_provider": launch_provider,
"launch_provider_abbrev": launch_provider_abbrev,
"launch_provider_type": get_nested(launch, ["launch_service_provider", "type"]),
"rocket": launch["rocket"]["configuration"]["full_name"],
"rocket": launch["rocket"]["configuration"],
"mission": launch.get("mission"),
"mission_name": get_nested(launch, ["mission", "name"]),
"pad_name": launch["pad"]["name"],
@ -174,7 +174,10 @@ def get_launches(
existing.sort(reverse=True)
if refresh or not existing or (now - existing[0][0]).seconds > ttl:
return next_launch_api(rocket_dir, limit=limit)
try:
return next_launch_api(rocket_dir, limit=limit)
except Exception:
pass # fallback to cached version
f = existing[0][1]