parlament.press: an explicit backfill_days overrides the cursor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
simonandClaude Opus 5.5 committed 2026-11-13 00:46:57 +01:00
1 parent 405c21a8c5
commit ccf1a4c755
1 file changed
+5 -1
+5 -1
View File
@@ -48,7 +48,11 @@ class ParlamentPress(Adapter):
def start(self, ctx: RunContext) -> Iterator[Request]:
last = ctx.state.get("last_date")
backfill = int(ctx.params.get("backfill_days", 365))
since = (date.fromisoformat(last) - timedelta(days=2)) if last else date.today() - timedelta(days=backfill)
# an explicit backfill_days (history backfill) wins over the cursor of the regular runs
if last and "backfill_days" not in ctx.params:
since = date.fromisoformat(last) - timedelta(days=2)
else:
since = date.today() - timedelta(days=backfill)
yield list_request(110, {"DATERANGE": [since.isoformat(), date.today().isoformat()]}, kind="list",
meta={"since": since.isoformat()})