Skip to content

Commit 1354919

Browse files
committed
gracefully handle no series updates
409 error code means the list isn't updated for today
1 parent b32a0fc commit 1354919

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/stats_can/scwds.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,20 @@ def get_changed_series_list() -> list[ChangedSeries]:
106106
Returns
107107
-------
108108
:
109-
list of changed series, one for each vector and when it was released
109+
list of changed series, one for each vector and when it was released.
110+
Returns an empty list if no series have been released yet today.
110111
"""
111-
return _fetch_and_validate(
112-
url=f"{SC_URL}getChangedSeriesList",
113-
schema=list[ChangedSeries],
114-
)
112+
try:
113+
return _fetch_and_validate(
114+
url=f"{SC_URL}getChangedSeriesList",
115+
schema=list[ChangedSeries],
116+
)
117+
except requests.HTTPError as exc:
118+
# The API returns 409 when no series have been released yet today,
119+
# which is a normal condition, not an error.
120+
if exc.response is not None and exc.response.status_code == 409:
121+
return []
122+
raise
115123

116124

117125
def get_changed_cube_list(date: dt.date | None = None) -> list[ChangedCube]:

0 commit comments

Comments
 (0)