Declare READS for Oracle, Personio, Phenom, Pinpoint, Recruitee, Rippling, SmartRecruiters, SuccessFactors, Teamtailor, Workable and Workday
Every row carries places (Personio additionalOffices, Workable and Recruitee locations[], every SuccessFactors address, Workday's own read), the list teaser of Phenom and Oracle is kept in teaser, and the level, employment and country a host states are mapped. Workday "N Locations" and "Country - City", and Recruitee "Remote job", are no longer places. Phenom takes dateCreated as posted. robots_page and ROBOTS_ANY_CASE go; READS.robots records the decision. Signatures are feed_url(slug, ask) and page(get, slug, cursor, ask), with an empty Ask as the default so the runner of today still calls them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c0da58da7
commit
4316624769
42 files changed
+3126
-199
No files matched your search
+73
-29
@@ -18,6 +18,7 @@ from __future__ import annotations
|
||||
|
||||
import html
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime, timedelta
|
||||
@@ -25,14 +26,21 @@ from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, only, parse_dt
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "workday"
|
||||
LABEL = "Workday"
|
||||
KEEP_CASE = True
|
||||
#: A tenant answers `/jobs` and `/Jobs` alike, so a rule in either case
|
||||
#: forbids the site.
|
||||
ROBOTS_ANY_CASE = True
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", page_size=20, ceiling=2000, text="detail",
|
||||
complete="stated", places="many",
|
||||
fields=Fields(posted="trusted", remote="stated", country="stated", employment="stated"),
|
||||
robots="read: robots.txt allows /<Site>/ (checked 2026-09-29)",
|
||||
)
|
||||
|
||||
#: One group for `<tenant>.<wdN>` and one for the site, which discovery joins
|
||||
#: into the slug with "/". A locale segment (`/en-US/`, `/de-DE/`) may come
|
||||
@@ -86,14 +94,7 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{_host(slug)}/{_parts(slug)[2]}" # type: ignore[index]
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
"""With the trailing slash, since the rules the tenants write are
|
||||
`Disallow: /<Site>/` and read as prefixes: `/<Site>` alone would slip
|
||||
past the very rule that forbids the site."""
|
||||
return careers_url(slug) + "/"
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
"""`cursor` is `(offset, total)`. `total` is read on the first page only:
|
||||
on the later ones it is 0 on most tenants and the real figure on a few,
|
||||
so it is carried. An offset at or past the end does not answer an empty
|
||||
@@ -160,6 +161,32 @@ def _remote(value: Any) -> str | None:
|
||||
return _REMOTE.get(str(value or "").strip().lower())
|
||||
|
||||
|
||||
#: `timeType` -> the app's employment words.
|
||||
_EMPLOYMENT = {"full time": "full_time", "part time": "part_time"}
|
||||
|
||||
#: What `locationsText` says of a role at several places: "2 Locations". The
|
||||
#: places arrive with the role's own read.
|
||||
_COUNT = re.compile(r"\d+ locations?", re.I)
|
||||
|
||||
|
||||
def _place(text: Any, remote: str | None) -> Place | None:
|
||||
"""A place as Workday writes it, or None for none. Some tenants write
|
||||
"Country - City" ("Denmark - Copenhagen", "USA - Texas - Austin"), which
|
||||
is turned round to the order the rest of the app reads, "Copenhagen,
|
||||
Denmark"; a place that starts with a work-mode word ("Remote - Germany")
|
||||
is left as it is. A place is remote or an office as far as the role's
|
||||
`remoteType` says."""
|
||||
text = " ".join(str(text or "").split())
|
||||
if not text or _COUNT.fullmatch(text):
|
||||
return None
|
||||
parts = [part.strip() for part in text.split(" - ")]
|
||||
if len(parts) > 1 and "," not in text and all(parts) \
|
||||
and not parts[0].lower().startswith(("remote", "hybrid", "on-site", "onsite")):
|
||||
text = ", ".join(reversed(parts))
|
||||
return {"text": text, "remote": {"remote": True, "hybrid": False, "onsite": False}.get(
|
||||
remote or "")}
|
||||
|
||||
|
||||
def rows(decoded: dict[str, Any], slug: str) -> list[Row]:
|
||||
"""One page of `.../wday/cxs/<tenant>/<Site>/jobs` -> `{"total",
|
||||
"jobPostings": [...], "facets": [...]}`. A posting has `title`,
|
||||
@@ -167,7 +194,7 @@ def rows(decoded: dict[str, Any], slug: str) -> list[Row]:
|
||||
(a place, or "2 Locations"), `postedOn` (relative text) and
|
||||
`bulletFields`, which lead with the requisition id, and on some tenants
|
||||
`remoteType`. No description, no date and no country: `detail` has
|
||||
those. The id is the requisition id where the path carries it, and the
|
||||
those, and the places of a role that "2 Locations" hides. The id is the requisition id where the path carries it, and the
|
||||
path where not; a posting with no title or no path is skipped."""
|
||||
out = []
|
||||
for p in decoded.get("jobPostings") or []:
|
||||
@@ -175,15 +202,18 @@ def rows(decoded: dict[str, Any], slug: str) -> list[Row]:
|
||||
path = (p.get("externalPath") or "").strip()
|
||||
if not title or not _ROLE_PATH.fullmatch(path):
|
||||
continue
|
||||
remote = _remote(p.get("remoteType"))
|
||||
place = _place(p.get("locationsText"), remote)
|
||||
out.append({
|
||||
"source_id": _requisition(p, path) or path,
|
||||
"title": title,
|
||||
"location": (p.get("locationsText") or "").strip(),
|
||||
"places": [place] if place else [],
|
||||
"location": place["text"] if place else "",
|
||||
"url": f"https://{_host(slug)}/{_parts(slug)[2]}{path}", # type: ignore[index]
|
||||
"posted": _posted(p.get("postedOn") or ""),
|
||||
"department": "",
|
||||
"description": "",
|
||||
"remote": _remote(p.get("remoteType")),
|
||||
"remote": remote,
|
||||
"salary_text": "", # no field for pay, only the description's text
|
||||
})
|
||||
return out
|
||||
@@ -208,26 +238,40 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
if description := " ".join(html.unescape(strip_html(posting.get("jobDescription") or ""))
|
||||
.split()):
|
||||
out["description"] = description
|
||||
if location := _location(posting):
|
||||
out["location"] = location
|
||||
remote = _remote(posting.get("remoteType"))
|
||||
if places := _places(posting, remote):
|
||||
out["places"] = places
|
||||
out["location"] = "; ".join(p["text"] for p in places)
|
||||
if len(places) == 1 and (code := _country_code(posting)):
|
||||
out["country"] = code
|
||||
if employment := _EMPLOYMENT.get(str(posting.get("timeType") or "").strip().lower()):
|
||||
out["employment"] = employment
|
||||
if posted := parse_dt(posting.get("startDate")):
|
||||
out["posted"] = posted
|
||||
if remote := _remote(posting.get("remoteType")):
|
||||
if remote:
|
||||
out["remote"] = remote
|
||||
return out
|
||||
|
||||
|
||||
def _location(posting: dict[str, Any]) -> str:
|
||||
"""The main location and the others, joined by "; " as Teamtailor does, so
|
||||
that `country_of` reads them one at a time and the listing's "2 Locations"
|
||||
is replaced by places. A single location that does not name its country
|
||||
def _country_code(posting: dict[str, Any]) -> str | None:
|
||||
"""The role's country as an ISO code, from the requisition's location. The
|
||||
code belongs to the main location only, so it is used for a role with one
|
||||
place."""
|
||||
country = (posting.get("jobRequisitionLocation") or {}).get("country") or {}
|
||||
code = str(country.get("alpha2Code") or "").strip().upper()
|
||||
return code if len(code) == 2 else None
|
||||
|
||||
|
||||
def _places(posting: dict[str, Any], remote: str | None) -> list[Place]:
|
||||
"""The main location and the additional ones, each once, which replace the
|
||||
listing's "2 Locations". A single location that does not name its country
|
||||
(LEGO's "Billund") gets it from the role's `country`."""
|
||||
places: list[str] = []
|
||||
for place in [posting.get("location"), *(posting.get("additionalLocations") or [])]:
|
||||
place = str(place or "").strip()
|
||||
if place and place not in places:
|
||||
places.append(place)
|
||||
found: list[Place] = []
|
||||
for name in [posting.get("location"), *(posting.get("additionalLocations") or [])]:
|
||||
place = _place(name, remote)
|
||||
if place and place["text"] not in (p["text"] for p in found):
|
||||
found.append(place)
|
||||
country = str((posting.get("country") or {}).get("descriptor") or "").strip()
|
||||
if len(places) == 1 and country and country.lower() not in places[0].lower():
|
||||
places[0] += f", {country}"
|
||||
return "; ".join(places)
|
||||
if len(found) == 1 and country and country.lower() not in found[0]["text"].lower():
|
||||
found[0]["text"] += f", {country}"
|
||||
return found
|
||||
Reference in new issue
Block a user