Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "MBTAclient"
version = "1.1.31"
version = "1.1.32"
description = "A Python client for interacting with the MBTA API"
readme = "README.md"
requires-python = ">=3.12"
Expand Down
12 changes: 9 additions & 3 deletions src/mbtaclient/trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,15 @@ def alerts(self) -> Optional[set[str]]:
if self.mbta_alerts:
for mbta_alert in self.mbta_alerts:
effect = " ".join(mbta_alert.effect.split("_"))
short_header = mbta_alert.short_header
alerts_details.add(effect + ": " + short_header)
return alerts_details
short_header = mbta_alert.short_header.strip()
header = mbta_alert.header.strip() if hasattr(mbta_alert, "header") else ""

# Use short_header if available, otherwise fallback to full header
detail = short_header if short_header else header
if detail: # only add if detail is not empty
alerts_details.add(f"{effect}: {detail}")

return alerts_details if alerts_details else None
return None

def get_stop_by_type(self, stop_type: str) -> Optional[Stop]:
Expand Down
Loading