diff --git a/agenda/thespacedevs.py b/agenda/thespacedevs.py index 6a995d1..1eafa68 100644 --- a/agenda/thespacedevs.py +++ b/agenda/thespacedevs.py @@ -86,8 +86,14 @@ launch_providers = { def summarize_launch(launch: Launch) -> Summary: """Summarize rocket launch.""" - launch_provider = launch["launch_service_provider"]["name"] - launch_provider_abbrev = launch_providers.get(launch_provider) + try: + launch_provider = launch["launch_service_provider"]["name"] + launch_provider_abbrev = launch_providers.get(launch_provider) + launch_provider_type = launch["launch_service_provider"]["type"] + except (TypeError, IndexError): + launch_provider = None + launch_provider_abbrev = None + launch_provider_type = None try: net_precision = launch["net_precision"]["name"] @@ -109,7 +115,7 @@ def summarize_launch(launch: Launch) -> Summary: "window_end": launch["window_end"], "launch_provider": launch_provider, "launch_provider_abbrev": launch_provider_abbrev, - "launch_provider_type": launch["launch_service_provider"]["type"], + "launch_provider_type": launch_provider_type, "rocket": launch["rocket"]["configuration"]["full_name"], "mission": launch["mission"], "mission_name": (launch["mission"]["name"] if launch["mission"] else None),