Take a Platsbanken region in the API and the CLI, and trust its and Teamtailor's posted date

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-29 16:23:19 +02:00
1 parent 43f0210b88
commit 0458c9c172
4 files changed
+12 -5

No files matched your search

+4 -2
View File
@@ -95,7 +95,7 @@ def build_parser() -> argparse.ArgumentParser:
searches_sub = searches.add_subparsers(dest="action", required=True)
search_add = searches_sub.add_parser(
"add", help="run a search once, then save it for every pull (or update it)")
search_add.add_argument("provider", choices=["jobindex", "adzuna"])
search_add.add_argument("provider", choices=["jobindex", "adzuna", "platsbanken"])
search_add.add_argument("name", help='what to call it, e.g. "Copenhagen backend"')
search_add.add_argument("--q", required=True,
help="the query, in the provider's own syntax")
@@ -104,6 +104,8 @@ def build_parser() -> argparse.ArgumentParser:
search_add.add_argument("--country", default="",
help="adzuna country: gb, de, nl, fr, at, be, es, it, pl, ch")
search_add.add_argument("--where", default="", help="adzuna place, e.g. Berlin")
search_add.add_argument("--region", default="",
help="platsbanken län id: CaRE_1nn_cSU is Skåne, empty all of Sweden")
search_add.add_argument("--pages", type=int, default=0,
help="result pages per pull (default 5, at most 10)")
searches_sub.add_parser("list", help="every saved search and its open roles")
@@ -423,7 +425,7 @@ def add_search(config: config_mod.Config, store: Store, args: argparse.Namespace
try:
params = jobs.sources.search_params(args.provider, args.q, area=args.area,
country=args.country, where=args.where,
pages=args.pages)
region=args.region, pages=args.pages)
sub, found, complete = jobs.sources.save_search(config, store, args.provider, args.name,
params)
except ValueError as exc:
+5 -1
View File
@@ -681,12 +681,16 @@ AFFINITY = range(-1, 3)
#: deployment carries no Adzuna key (`plugins.search`'s own docstring:
#: "not yet run live") and no Adzuna subscription exists to fetch.
#:
#: - `teamtailor`: the feed's `pubDate`, and `platsbanken`: `publication_date`,
#: both named as publication. Read on live feeds on 2026-09-29, where the
#: dates were spread over weeks, not checked against stored roles.
#:
#: A host not listed here, or a role whose stored `published_at` fails the
#: sanity check in `posted_at`, keeps `first_seen` as its posted date — the
#: safe default this migration is replacing everywhere else.
TRUSTED_POSTED_HOSTS: frozenset[str] = frozenset({
"greenhouse", "lever", "ashby", "workable", "smartrecruiters", "recruitee",
"personio", "jobindex", "adzuna",
"personio", "teamtailor", "jobindex", "adzuna", "platsbanken",
})
#: A `published_at` before this is a parsing slip or a placeholder, not a
+2 -1
View File
@@ -538,6 +538,7 @@ class SearchBody(BaseModel):
area: int = 0
country: str = ""
where: str = ""
region: str = ""
pages: Annotated[int, Field(ge=0, le=10)] = 0
@@ -545,7 +546,7 @@ def _params(body: SearchBody) -> dict[str, Any]:
try:
return jobs.sources.search_params(body.provider, body.q, area=body.area,
country=body.country, where=body.where,
pages=body.pages)
region=body.region, pages=body.pages)
except ValueError as exc:
raise HTTPException(422, str(exc)) from exc