Merge branch 'wp-d2-hosts'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
dec5fd5009
42 files changed
+3126
-199
No files matched your search
+29
-14
@@ -21,6 +21,7 @@ from urllib.parse import quote
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, only, parse_dt
|
||||
|
||||
NAME = "oracle"
|
||||
@@ -38,6 +39,14 @@ PATTERNS = (
|
||||
r"oraclecloud\.(?:com|eu)/hcmUI(?!/CandidateExperience/[A-Za-z_-]+/sites/)",
|
||||
)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", page_size=200, text="detail", teaser=True,
|
||||
complete="stated", places="many",
|
||||
fields=Fields(posted="trusted", remote="stated", country="stated"),
|
||||
robots=("read: robots.txt allows /hcmUI/CandidateExperience/en/sites/<site>/jobs "
|
||||
"(checked 2026-09-29)"),
|
||||
)
|
||||
|
||||
#: The page size asked for. 200 was answered in full by Nokia (600 roles in
|
||||
#: three calls of about 360 KB, 2026-09-29); the cursor advances by what a page
|
||||
#: returned, so a tenant that caps `limit` lower would not skip a role.
|
||||
@@ -77,15 +86,11 @@ def careers_url(slug: str) -> str:
|
||||
return f"{_base(slug)}/jobs"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def _api(slug: str) -> str:
|
||||
return f"https://{_parts(slug)[0]}/hcmRestApi/resources/latest"
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
"""One page of `recruitingCEJobRequisitions`. The answer's outer `count`,
|
||||
`hasMore` and `limit` describe the one search wrapper in `items`, so the
|
||||
total (`TotalJobsCount`) and the roles (`requisitionList`) are read from
|
||||
@@ -135,22 +140,32 @@ def rows(search: dict[str, Any], slug: str) -> list[Row]:
|
||||
# The id goes into a URL, and a listing is external content.
|
||||
if not title or not re.fullmatch(r"[A-Za-z0-9_-]+", role_id):
|
||||
continue
|
||||
places: list[str] = []
|
||||
for name in (_text(role.get("PrimaryLocation")),
|
||||
*(_text(s.get("Name")) for s in role.get("secondaryLocations") or []
|
||||
if isinstance(s, dict))):
|
||||
if name and name not in places:
|
||||
places.append(name)
|
||||
remote = _REMOTE.get(_text(role.get("WorkplaceTypeCode")).lower())
|
||||
places: list[Place] = []
|
||||
codes: set[str] = set()
|
||||
secondary = [s for s in role.get("secondaryLocations") or [] if isinstance(s, dict)]
|
||||
for name, code in ((_text(role.get("PrimaryLocation")),
|
||||
_text(role.get("PrimaryLocationCountry"))),
|
||||
*((_text(s.get("Name")), _text(s.get("CountryCode")))
|
||||
for s in secondary)):
|
||||
if name and name not in (p["text"] for p in places):
|
||||
places.append({"text": name, "remote": {"remote": True, "hybrid": False,
|
||||
"onsite": False}.get(remote or "")})
|
||||
if code:
|
||||
codes.add(code.upper())
|
||||
out.append({
|
||||
"source_id": role_id,
|
||||
"title": title,
|
||||
"location": "; ".join(places),
|
||||
"places": places,
|
||||
"location": "; ".join(p["text"] for p in places),
|
||||
"url": f"{_base(slug)}/job/{role_id}",
|
||||
"posted": parse_dt(role.get("PostedDate")),
|
||||
"department": (_text(role.get("JobFamily")) or _text(role.get("JobFunction"))
|
||||
or _text(role.get("Department")) or _text(role.get("Organization"))),
|
||||
"description": _plain(role.get("ShortDescriptionStr")),
|
||||
"remote": _REMOTE.get(_text(role.get("WorkplaceTypeCode")).lower()),
|
||||
"description": "",
|
||||
"teaser": _plain(role.get("ShortDescriptionStr")),
|
||||
"country": next(iter(codes)) if len(codes) == 1 else None,
|
||||
"remote": remote,
|
||||
"salary_text": "", # the resource states no pay
|
||||
})
|
||||
return out
|
||||
|
||||
@@ -7,18 +7,42 @@ Personio.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import xml.etree.ElementTree as ET
|
||||
from collections.abc import Callable
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Row, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "personio"
|
||||
LABEL = "Personio"
|
||||
RANK = 70
|
||||
PATTERNS = (r"https?://([a-z0-9-]+)\.jobs\.personio\.(?:de|com)",)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="listing", complete="whole",
|
||||
places="many",
|
||||
fields=Fields(pay="figures", posted="trusted", seniority="stated", employment="stated"),
|
||||
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
||||
)
|
||||
|
||||
#: `seniority` -> the app's levels. `experienced` is what most roles say and
|
||||
#: names no level, so it is known and maps to none; a word not listed is
|
||||
#: logged at debug level so the table can grow.
|
||||
_SENIORITY = {"entry-level": "junior", "student": "intern", "executive": "exec",
|
||||
"experienced": ""}
|
||||
|
||||
#: `employmentType` when it is not the usual permanent contract, to the app's
|
||||
#: employment words; `permanent` says nothing about the hours, so `schedule`
|
||||
#: decides then.
|
||||
_CONTRACT = {"temporary": "temporary", "freelance": "contract", "intern": "internship",
|
||||
"working_student": "internship", "trainee": "internship"}
|
||||
_SCHEDULE = {"full-time": "full_time", "part-time": "part_time"}
|
||||
|
||||
#: Personio's `salaryInformation/type` spellings, to the plain period word
|
||||
#: `pay_line` wants ("yearly" -> "year"). Anything else is passed through.
|
||||
_PERIODS = {"yearly": "year", "monthly": "month", "hourly": "hour",
|
||||
@@ -39,7 +63,7 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{slug}.jobs.personio.de"
|
||||
|
||||
|
||||
def feed_url(slug: str) -> str:
|
||||
def feed_url(slug: str, ask: Ask = Ask()) -> str:
|
||||
return f"https://{slug}.jobs.personio.de/xml"
|
||||
|
||||
|
||||
@@ -61,10 +85,46 @@ def _salary_text(salary_info: ET.Element) -> str:
|
||||
salary_info.findtext("currencyCode"), period)
|
||||
|
||||
|
||||
def _seniority(word: str) -> str | None:
|
||||
key = word.strip().lower()
|
||||
if key not in _SENIORITY:
|
||||
if key:
|
||||
log.debug("personio: unknown seniority %r", word)
|
||||
return None
|
||||
return _SENIORITY[key] or None
|
||||
|
||||
|
||||
def _employment(position: ET.Element) -> str | None:
|
||||
contract = (position.findtext("employmentType") or "").strip().lower()
|
||||
schedule = (position.findtext("schedule") or "").strip().lower()
|
||||
if contract in _CONTRACT:
|
||||
return _CONTRACT[contract]
|
||||
if contract and contract != "permanent":
|
||||
log.debug("personio: unknown employmentType %r", contract)
|
||||
return _SCHEDULE.get(schedule)
|
||||
|
||||
|
||||
def _places(position: ET.Element) -> list[Place]:
|
||||
"""The `office` and every `additionalOffices/office`, each once. The feed
|
||||
has no remote flag; an office named "Remote" or "Berlin (Remote)" is
|
||||
remote, any other says nothing."""
|
||||
found: list[Place] = []
|
||||
names = [position.findtext("office"),
|
||||
*(o.text for o in position.findall("additionalOffices/office"))]
|
||||
for name in names:
|
||||
text = (name or "").strip()
|
||||
if text and text not in (p["text"] for p in found):
|
||||
found.append({"text": text, "remote": True if "remote" in text.lower() else None})
|
||||
return found
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"""`{slug}.jobs.personio.de/xml` -> `<workzag-jobs><position>...`. No job
|
||||
URL in the feed itself; Personio's own page is `/job/{id}`, confirmed
|
||||
live against a real posting (2026-09-23)."""
|
||||
live against a real posting (2026-09-23). `additionalOffices` lists the
|
||||
other places of a role (116 of 320 at the three boards read); `seniority`
|
||||
is one of entry-level, experienced, executive, student, and `schedule` and
|
||||
`employmentType` state the hours and the contract."""
|
||||
root = ET.fromstring(body)
|
||||
rows = []
|
||||
for position in root.findall("position"):
|
||||
@@ -84,15 +144,19 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
salary_info.findtext("currencyCode"), salary_info.findtext("type"),
|
||||
{"yearly": 1, "monthly": 12})
|
||||
salary_text = _salary_text(salary_info)
|
||||
places = _places(position)
|
||||
rows.append({
|
||||
"source_id": job_id,
|
||||
"title": title,
|
||||
"location": (position.findtext("office") or "").strip(),
|
||||
"places": places,
|
||||
"location": "; ".join(p["text"] for p in places),
|
||||
"url": f"https://{slug}.jobs.personio.de/job/{job_id}",
|
||||
"posted": parse_dt(position.findtext("createdAt")),
|
||||
"department": (position.findtext("department") or "").strip(),
|
||||
"description": strip_html(description),
|
||||
"remote": "remote" in (position.findtext("office") or "").lower() or None,
|
||||
"remote": any(p["remote"] for p in places) or None,
|
||||
"seniority": _seniority(position.findtext("seniority") or ""),
|
||||
"employment": _employment(position),
|
||||
"salary_text": salary_text,
|
||||
"salary_min": salary_min,
|
||||
"salary_max": salary_max,
|
||||
|
||||
+24
-16
@@ -21,6 +21,7 @@ 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
|
||||
|
||||
NAME = "phenom"
|
||||
@@ -34,6 +35,12 @@ PATTERNS = (
|
||||
r"phenompeople\.com|phenom\.com/careers",
|
||||
)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", page_size=100, text="detail", teaser=True,
|
||||
complete="stated", places="many", fields=Fields(posted="trusted", remote="stated"),
|
||||
robots="read: robots.txt allows /<country>/<lang>/search-results (checked 2026-09-29)",
|
||||
)
|
||||
|
||||
#: The page size asked for. 100 is what the site's own search sends; `size`
|
||||
#: 200 was answered in full by Just Eat Takeaway and 500 by Philips (of 865),
|
||||
#: but a page is 340 KB at 100 roles already.
|
||||
@@ -70,10 +77,6 @@ def careers_url(slug: str) -> str:
|
||||
return f"{_root(slug)}/search-results"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def _body(slug: str, offset: int) -> dict[str, Any]:
|
||||
"""What the site's search page sends for a listing of every role, newest
|
||||
first, less the parts that only tell the page what to draw. `lang` is
|
||||
@@ -99,7 +102,7 @@ def _key(job: dict[str, Any]) -> str:
|
||||
return str(job.get("jobSeqNo") or job.get("jobId") or job.get("reqId") or "").strip()
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
offset = int(cursor or 0)
|
||||
host = _parts(slug)[0]
|
||||
data = json.loads(get(f"https://{host}/widgets", method="POST",
|
||||
@@ -133,10 +136,12 @@ def _slug_of(title: str) -> str:
|
||||
|
||||
def rows(search: dict[str, Any], slug: str) -> list[Row]:
|
||||
"""The roles of one page, `refineSearch.data.jobs`. A role has the title,
|
||||
`jobSeqNo`, `postedDate` (a date at midnight), `category`, the locations
|
||||
as `multi_location` (a list, one per place) beside `location` (the first),
|
||||
and `descriptionTeaser`, the first paragraph of the text; the full text is
|
||||
on the role's page, see `detail`. `applyUrl` points at the apply system
|
||||
`jobSeqNo`, `dateCreated` (the posting) beside `postedDate` (a date at
|
||||
midnight that the site moves when it refreshes a role: King's "12mth FTC"
|
||||
role, created in June, says 28 September), `category`, the locations as
|
||||
`multi_location` (a list, one per place) beside `location` (the first),
|
||||
and `descriptionTeaser`, the first paragraph of the text, kept as `teaser`;
|
||||
the full text is on the role's page, see `detail`. `applyUrl` points at the apply system
|
||||
(Workday for Just Eat Takeaway and Philips), so the role's URL is its page
|
||||
on the site. No remote flag and no pay are in the list."""
|
||||
out = []
|
||||
@@ -145,19 +150,22 @@ def rows(search: dict[str, Any], slug: str) -> list[Row]:
|
||||
title = _text(job.get("title"))
|
||||
if not title or not key:
|
||||
continue
|
||||
places: list[str] = []
|
||||
for place in (*(job.get("multi_location") or []), job.get("location")):
|
||||
if isinstance(place, str) and place.strip() and place.strip() not in places:
|
||||
places.append(place.strip())
|
||||
places: list[Place] = []
|
||||
for place in (job.get("location"), *(job.get("multi_location") or [])):
|
||||
if isinstance(place, str) and place.strip() \
|
||||
and place.strip() not in (p["text"] for p in places):
|
||||
places.append({"text": place.strip(), "remote": None})
|
||||
tail = _slug_of(title)
|
||||
out.append({
|
||||
"source_id": key,
|
||||
"title": title,
|
||||
"location": "; ".join(places),
|
||||
"places": places,
|
||||
"location": "; ".join(p["text"] for p in places),
|
||||
"url": f"{_root(slug)}/job/{key}" + (f"/{tail}" if tail else ""),
|
||||
"posted": parse_dt(job.get("postedDate")),
|
||||
"posted": parse_dt(job.get("dateCreated") or job.get("postedDate")),
|
||||
"department": _text(job.get("category")),
|
||||
"description": _plain(job.get("descriptionTeaser")),
|
||||
"description": "",
|
||||
"teaser": _plain(job.get("descriptionTeaser")),
|
||||
"remote": None, # the list does not say
|
||||
"salary_text": "", # nor does it state pay
|
||||
})
|
||||
|
||||
@@ -18,17 +18,27 @@ from __future__ import annotations
|
||||
|
||||
import html
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Reads
|
||||
from ._shared import Row, is_web_url, label_slug_ok, num, only, pay_line, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "pinpoint"
|
||||
LABEL = "Pinpoint"
|
||||
PATTERNS = (r"https?://([a-z0-9-]+)\.pinpointhq\.com",)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="listing", complete="whole", places="one",
|
||||
fields=Fields(pay="figures", remote="stated", employment="stated"),
|
||||
robots="read: robots.txt allows / (checked 2026-09-29)",
|
||||
)
|
||||
|
||||
#: `workplace_type` -> `store._remote`'s words. Anything else says nothing.
|
||||
_REMOTE = {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"}
|
||||
|
||||
@@ -41,6 +51,12 @@ _YEARLY = {"annually": 1, "annual": 1, "yearly": 1, "year": 1, "monthly": 12, "m
|
||||
_PERIOD = {"annually": "year", "annual": "year", "yearly": "year", "monthly": "month",
|
||||
"weekly": "week", "daily": "day", "hourly": "hour"}
|
||||
|
||||
#: What `employment_type` (`permanent_full_time`, `fixed_term_full_time`) says,
|
||||
#: the first fragment found deciding, so a contract type beats the hours.
|
||||
_EMPLOYMENT = (("intern", "internship"), ("freelance", "contract"), ("contract", "contract"),
|
||||
("fixed_term", "temporary"), ("temporary", "temporary"),
|
||||
("part_time", "part_time"), ("full_time", "full_time"))
|
||||
|
||||
#: The sections of a posting's text, in the order the page shows them: the
|
||||
#: description, then these fields, each with its own heading in `<field>_header`.
|
||||
_SECTIONS = ("key_responsibilities", "skills_knowledge_expertise", "benefits")
|
||||
@@ -62,11 +78,7 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{host(slug)}/"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def feed_url(slug: str) -> str:
|
||||
def feed_url(slug: str, ask: Ask = Ask()) -> str:
|
||||
return f"https://{host(slug)}/postings.json"
|
||||
|
||||
|
||||
@@ -100,6 +112,16 @@ def _place(location: dict[str, Any]) -> str:
|
||||
return ", ".join(parts)
|
||||
|
||||
|
||||
def _employment(code: str) -> str | None:
|
||||
code = code.strip().lower()
|
||||
for fragment, value in _EMPLOYMENT:
|
||||
if fragment in code:
|
||||
return value
|
||||
if code:
|
||||
log.debug("pinpoint: unknown employment_type %r", code)
|
||||
return None
|
||||
|
||||
|
||||
def _pay(j: dict[str, Any]) -> tuple[int | None, int | None, str, str]:
|
||||
"""`(salary_min, salary_max, currency, salary_text)` of a posting whose
|
||||
pay is shown (`compensation_visible`); the free-text `compensation` is the
|
||||
@@ -132,15 +154,21 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
continue
|
||||
job = j.get("job") or {}
|
||||
low, high, currency, salary_text = _pay(j)
|
||||
workplace = str(j.get("workplace_type") or "").strip().lower()
|
||||
place = _place(j.get("location") or {})
|
||||
out.append({
|
||||
"source_id": source_id,
|
||||
"title": title,
|
||||
"location": _place(j.get("location") or {}),
|
||||
"places": [{"text": place, "remote": {"remote": True, "onsite": False,
|
||||
"on_site": False, "hybrid": False}.get(workplace)}]
|
||||
if place else [],
|
||||
"location": place,
|
||||
"url": url,
|
||||
"posted": None, # only the posting's own page has a date
|
||||
"department": str((job.get("department") or {}).get("name") or "").strip(),
|
||||
"description": _text(j),
|
||||
"remote": _REMOTE.get(str(j.get("workplace_type") or "").strip().lower()),
|
||||
"remote": _REMOTE.get(workplace),
|
||||
"employment": _employment(str(j.get("employment_type") or "")),
|
||||
"salary_text": salary_text,
|
||||
"salary_min": low,
|
||||
"salary_max": high,
|
||||
|
||||
@@ -8,18 +8,45 @@ Recruitee.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Row, is_web_url, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "recruitee"
|
||||
LABEL = "Recruitee"
|
||||
RANK = 60
|
||||
PATTERNS = (r"https?://([a-z0-9-]+)\.recruitee\.com",)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="listing", complete="whole",
|
||||
places="many",
|
||||
fields=Fields(pay="figures", posted="trusted", remote="stated", country="stated",
|
||||
seniority="stated", employment="stated"),
|
||||
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
||||
)
|
||||
|
||||
#: `experience_code` -> the app's levels. `experienced` names no level and is
|
||||
#: known, so it maps to none; a word not listed is logged at debug level.
|
||||
_SENIORITY = {"student_school": "intern", "entry_level": "junior", "mid_level": "mid",
|
||||
"experienced": ""}
|
||||
|
||||
#: The words of `employment_type_code` (`fulltime_permanent`), the first that
|
||||
#: is found deciding, so a contract type beats the hours.
|
||||
_EMPLOYMENT = (("internship", "internship"), ("intern", "internship"),
|
||||
("freelance", "contract"), ("contract", "contract"),
|
||||
("temporary", "temporary"), ("fixed", "temporary"),
|
||||
("parttime", "part_time"), ("fulltime", "full_time"))
|
||||
|
||||
#: What the board writes as a place for a role that is worked anywhere.
|
||||
_NO_PLACE = ("remote job",)
|
||||
|
||||
|
||||
def slug_ok(slug: str) -> bool:
|
||||
return label_slug_ok(slug)
|
||||
@@ -35,7 +62,7 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{slug}.recruitee.com"
|
||||
|
||||
|
||||
def feed_url(slug: str) -> str:
|
||||
def feed_url(slug: str, ask: Ask = Ask()) -> str:
|
||||
return f"https://{slug}.recruitee.com/api/offers/"
|
||||
|
||||
|
||||
@@ -55,7 +82,63 @@ def _salary_text(salary: dict[str, Any]) -> str:
|
||||
salary.get("currency"), period)
|
||||
|
||||
|
||||
def _seniority(code: str) -> str | None:
|
||||
key = code.strip().lower()
|
||||
if key not in _SENIORITY:
|
||||
if key:
|
||||
log.debug("recruitee: unknown experience_code %r", code)
|
||||
return None
|
||||
return _SENIORITY[key] or None
|
||||
|
||||
|
||||
def _employment(code: str) -> str | None:
|
||||
words = set(code.strip().lower().replace("-", "_").split("_"))
|
||||
for word, value in _EMPLOYMENT:
|
||||
if word in words:
|
||||
return value
|
||||
if code.strip():
|
||||
log.debug("recruitee: unknown employment_type_code %r", code)
|
||||
return None
|
||||
|
||||
|
||||
def _places(offer: dict[str, Any]) -> tuple[list[Place], set[str]]:
|
||||
"""Every place of an offer and the countries' codes among them. `locations`
|
||||
lists them (city, state, country), `location` is the first as one line and
|
||||
is the fallback for an offer that lists none. The board writes "Remote
|
||||
job" where an offer has no place: that is not one, and a remote offer with
|
||||
no other place has the place "Remote"."""
|
||||
found: list[Place] = []
|
||||
codes: set[str] = set()
|
||||
|
||||
def add(text: str) -> None:
|
||||
text = text.strip()
|
||||
if text and text.lower() not in _NO_PLACE and text not in (p["text"] for p in found):
|
||||
found.append({"text": text, "remote": None})
|
||||
|
||||
for loc in offer.get("locations") or []:
|
||||
if not isinstance(loc, dict):
|
||||
continue
|
||||
parts: list[str] = []
|
||||
for part in (loc.get("city") or loc.get("name"), loc.get("state"), loc.get("country")):
|
||||
part = str(part or "").strip()
|
||||
if part and part not in parts:
|
||||
parts.append(part)
|
||||
add(", ".join(parts))
|
||||
if code := str(loc.get("country_code") or "").strip().upper():
|
||||
codes.add(code)
|
||||
if not found:
|
||||
add(str(offer.get("location") or offer.get("city") or ""))
|
||||
if code := str(offer.get("country_code") or "").strip().upper():
|
||||
codes.add(code)
|
||||
if not found and offer.get("remote"):
|
||||
found.append({"text": "Remote", "remote": True})
|
||||
return found, codes
|
||||
|
||||
|
||||
def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"""`{slug}.recruitee.com/api/offers/` -> `{"offers": [...]}`. An offer has
|
||||
`locations` (a list; 9 of 16 at bunq have two or three), `remote`,
|
||||
`experience_code` and `employment_type_code`, and the salary object."""
|
||||
data = json.loads(body)
|
||||
rows = []
|
||||
for j in data.get("offers") or []:
|
||||
@@ -67,10 +150,12 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
salary_min, salary_max, currency = yearly_amount(
|
||||
salary.get("min"), salary.get("max"), salary.get("currency"),
|
||||
salary.get("period"), {"year": 1, "month": 12})
|
||||
places, codes = _places(j)
|
||||
rows.append({
|
||||
"source_id": str(j.get("id") or ""),
|
||||
"title": title,
|
||||
"location": (j.get("location") or j.get("city") or "").strip(),
|
||||
"places": places,
|
||||
"location": "; ".join(p["text"] for p in places),
|
||||
"url": url,
|
||||
"posted": parse_dt(j.get("published_at") or j.get("created_at")),
|
||||
"department": (j.get("department") or "").strip(),
|
||||
@@ -80,5 +165,8 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"salary_min": salary_min,
|
||||
"salary_max": salary_max,
|
||||
"currency": currency,
|
||||
"country": next(iter(codes)) if len(codes) == 1 else None,
|
||||
"seniority": _seniority(str(j.get("experience_code") or "")),
|
||||
"employment": _employment(str(j.get("employment_type_code") or "")),
|
||||
})
|
||||
return rows
|
||||
+45
-15
@@ -12,14 +12,18 @@ from __future__ import annotations
|
||||
|
||||
import html
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Row, parse_dt, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "rippling"
|
||||
LABEL = "Rippling"
|
||||
KEEP_CASE = True
|
||||
@@ -28,6 +32,13 @@ PATTERNS = (
|
||||
r"api\.rippling\.com/platform/api/ats/v1/board/([A-Za-z0-9][A-Za-z0-9_-]*)",
|
||||
)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="whole", text="detail", complete="whole", places="many",
|
||||
fields=Fields(pay="figures", posted="trusted", employment="stated"),
|
||||
robots=("read: robots.txt allows /<slug>/jobs on ats.rippling.com, the API host has none "
|
||||
"(checked 2026-09-29)"),
|
||||
)
|
||||
|
||||
_API = "api.rippling.com"
|
||||
_SITE = "ats.rippling.com"
|
||||
|
||||
@@ -35,6 +46,11 @@ _SITE = "ats.rippling.com"
|
||||
#: whole; it is also what discovery's patterns take.
|
||||
_SLUG = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*")
|
||||
|
||||
#: The words of `employmentType.label` (`SALARIED_FT`), split at "_".
|
||||
_EMPLOYMENT = {"FT": "full_time", "PT": "part_time", "INTERN": "internship",
|
||||
"INTERNSHIP": "internship", "CONTRACT": "contract", "CONTRACTOR": "contract",
|
||||
"TEMP": "temporary", "TEMPORARY": "temporary", "SEASONAL": "temporary"}
|
||||
|
||||
#: A role's id in the board's own links.
|
||||
_UUID = re.compile(r"[0-9A-Za-z-]{8,64}")
|
||||
|
||||
@@ -51,17 +67,17 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{_SITE}/{slug}/jobs"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
"""The page a person opens. The API host has no robots.txt (a 404, which
|
||||
allows), so the site's is the one that says something."""
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def _board(slug: str) -> str:
|
||||
return f"https://{_API}/platform/api/ats/v1/board/{slug}"
|
||||
|
||||
|
||||
def feed_url(slug: str) -> str:
|
||||
def _place(text: str) -> Place:
|
||||
"""A place as the board labels it; "Remote (United States)" is remote, any
|
||||
other label says nothing."""
|
||||
return {"text": text, "remote": True if text.lower().startswith("remote") else None}
|
||||
|
||||
|
||||
def feed_url(slug: str, ask: Ask = Ask()) -> str:
|
||||
return f"{_board(slug)}/jobs"
|
||||
|
||||
|
||||
@@ -69,14 +85,14 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"""The board's array -> one row per role. The array has one entry per
|
||||
role and place, so a role in three cities is three entries with one
|
||||
`uuid` (Rippling's own board: 638 entries, 326 roles); the rows merge
|
||||
them, the places joined with "; ". The entry has no description, date
|
||||
them, the places kept as a list and joined with "; " for `location`. The entry has no description, date
|
||||
or pay: `detail` reads them. `remote` is True only when every place is a
|
||||
"Remote (...)" one, since a label says nothing else about the work."""
|
||||
data = json.loads(body)
|
||||
if not isinstance(data, list):
|
||||
raise ValueError("not a Rippling board: the answer is not a list")
|
||||
roles: dict[str, Row] = {}
|
||||
places: dict[str, list[str]] = {}
|
||||
places: dict[str, list[Place]] = {}
|
||||
for entry in data:
|
||||
job_id = str(entry.get("uuid") or "").strip()
|
||||
title = (entry.get("name") or "").strip()
|
||||
@@ -84,8 +100,8 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
continue
|
||||
place = str(((entry.get("workLocation") or {}).get("label")) or "").strip()
|
||||
places.setdefault(job_id, [])
|
||||
if place and place not in places[job_id]:
|
||||
places[job_id].append(place)
|
||||
if place and place not in (p["text"] for p in places[job_id]):
|
||||
places[job_id].append(_place(place))
|
||||
roles.setdefault(job_id, {
|
||||
"source_id": job_id,
|
||||
"title": title,
|
||||
@@ -96,12 +112,23 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
"salary_text": "", # the board's list states no pay
|
||||
})
|
||||
for job_id, row in roles.items():
|
||||
row["location"] = "; ".join(places[job_id])
|
||||
row["places"] = places[job_id]
|
||||
row["location"] = "; ".join(p["text"] for p in places[job_id])
|
||||
row["remote"] = True if places[job_id] and all(
|
||||
p.lower().startswith("remote") for p in places[job_id]) else None
|
||||
p["remote"] for p in places[job_id]) else None
|
||||
return list(roles.values())
|
||||
|
||||
|
||||
def _employment(kind: Any) -> str | None:
|
||||
label = str((kind or {}).get("label") or "").strip().upper() if isinstance(kind, dict) else ""
|
||||
for word in label.split("_"):
|
||||
if word in _EMPLOYMENT:
|
||||
return _EMPLOYMENT[word]
|
||||
if label:
|
||||
log.debug("rippling: unknown employmentType %r", label)
|
||||
return None
|
||||
|
||||
|
||||
def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"""`<board>/jobs/<uuid>`: the description as HTML (`description.role`, or
|
||||
the company's text when a role has none), every place in `workLocations`,
|
||||
@@ -114,8 +141,11 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"description": html.unescape(strip_html(text.get("role") or text.get("company") or "")),
|
||||
"posted": parse_dt(data.get("createdOn")),
|
||||
}
|
||||
if places := [p for p in (str(p).strip() for p in data.get("workLocations") or []) if p]:
|
||||
found["location"] = "; ".join(dict.fromkeys(places))
|
||||
if names := [p for p in (str(p).strip() for p in data.get("workLocations") or []) if p]:
|
||||
found["places"] = [_place(name) for name in dict.fromkeys(names)]
|
||||
found["location"] = "; ".join(dict.fromkeys(names))
|
||||
if employment := _employment(data.get("employmentType")):
|
||||
found["employment"] = employment
|
||||
ranges = data.get("payRangeDetails") or []
|
||||
if len(ranges) == 1:
|
||||
pay = ranges[0]
|
||||
|
||||
@@ -8,11 +8,15 @@ SmartRecruiters.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, only, parse_dt, path_slug_ok
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "smartrecruiters"
|
||||
LABEL = "SmartRecruiters"
|
||||
RANK = 50
|
||||
@@ -20,8 +24,28 @@ PATTERNS = (
|
||||
r"(?:jobs|careers|api)\.smartrecruiters\.com/(?:v1/companies/)?([A-Za-z0-9_-]+)",
|
||||
)
|
||||
|
||||
#: An unknown identifier answers an empty list, which is `empty="suspect"`.
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", page_size=100, text="none", complete="stated",
|
||||
places="one", empty="suspect",
|
||||
fields=Fields(posted="trusted", remote="stated", country="stated", seniority="stated",
|
||||
employment="stated"),
|
||||
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
||||
)
|
||||
|
||||
_API = "api.smartrecruiters.com"
|
||||
|
||||
#: `experienceLevel.id` -> the app's levels. The three in the middle name no
|
||||
#: level ("associate" is half of Bosch's roles) and are known, so they map to
|
||||
#: none; an id not listed is logged at debug level.
|
||||
_SENIORITY = {"internship": "intern", "entry_level": "junior", "director": "director",
|
||||
"executive": "exec", "associate": "", "mid_senior_level": "",
|
||||
"not_applicable": ""}
|
||||
|
||||
#: `typeOfEmployment.id` -> the app's employment words.
|
||||
_EMPLOYMENT = {"permanent": "", "intern": "internship", "temporary": "temporary",
|
||||
"contract": "contract", "part_time": "part_time", "full_time": "full_time"}
|
||||
|
||||
#: The page size asked for, which is also the most the host serves per page.
|
||||
PAGE_SIZE = 100
|
||||
|
||||
@@ -48,7 +72,7 @@ def probe_ok(body: bytes) -> bool:
|
||||
return b'"totalFound":' in body and b'"totalFound":0' not in body
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
offset = int(cursor or 0)
|
||||
data = json.loads(get(f"https://{_API}/v1/companies/{slug}/postings"
|
||||
f"?offset={offset}&limit={PAGE_SIZE}"))
|
||||
@@ -60,13 +84,24 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
return rows(json.loads(body), slug)
|
||||
|
||||
|
||||
def _word(job: dict[str, Any], key: str, table: dict[str, str]) -> str | None:
|
||||
"""The `id` of the object `job[key]` looked up in `table`; none for a word
|
||||
the table maps to none, and a word it does not know is logged."""
|
||||
word = str((job.get(key) or {}).get("id") or "").strip().lower()
|
||||
if word and word not in table:
|
||||
log.debug("smartrecruiters: unknown %s %r", key, word)
|
||||
return table.get(word) or None
|
||||
|
||||
|
||||
def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
"""One page of https://api.smartrecruiters.com/v1/companies/{slug}/postings
|
||||
-> `{"offset", "limit", "totalFound", "content": [...]}`. At most 100 a
|
||||
page, whatever `limit` asks for; the next is `?offset=` further on. The
|
||||
list omits the job description (only the per-posting detail endpoint has
|
||||
it, and fetching one per row would be hundreds of extra requests per
|
||||
board), so `description` stays empty here."""
|
||||
board), so `description` stays empty here. A posting has one location,
|
||||
its `country` a lower-case ISO code, `experienceLevel` and
|
||||
`typeOfEmployment` (an `id` and a `label` each)."""
|
||||
out = []
|
||||
for j in data.get("content") or []:
|
||||
title = (j.get("name") or "").strip()
|
||||
@@ -76,15 +111,24 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
location = j.get("location") or {}
|
||||
loc_text = (location.get("fullLocation")
|
||||
or ", ".join(p for p in (location.get("city"), location.get("country")) if p))
|
||||
# `fullLocation` writes an empty region as ", ,": "Hatvan, , Hungary".
|
||||
loc_text = ", ".join(part.strip() for part in (loc_text or "").split(",")
|
||||
if part.strip())
|
||||
place: Place = {"text": loc_text, "remote": location.get("remote")}
|
||||
country = str(location.get("country") or "").strip().upper()
|
||||
out.append({
|
||||
"source_id": job_id,
|
||||
"title": title,
|
||||
"location": (loc_text or "").strip(),
|
||||
"places": [place] if loc_text else [],
|
||||
"location": loc_text,
|
||||
"url": f"https://jobs.smartrecruiters.com/{slug}/{job_id}",
|
||||
"posted": parse_dt(j.get("releasedDate")),
|
||||
"department": ((j.get("department") or {}).get("label") or "").strip(),
|
||||
"description": "",
|
||||
"remote": location.get("remote"),
|
||||
"salary_text": "", # SmartRecruiters' list endpoint states no pay at all
|
||||
"country": country if len(country) == 2 else None,
|
||||
"seniority": _word(j, "experienceLevel", _SENIORITY),
|
||||
"employment": _word(j, "typeOfEmployment", _EMPLOYMENT),
|
||||
})
|
||||
return out
|
||||
@@ -35,7 +35,8 @@ country filter in this version.
|
||||
|
||||
A role's own page carries microdata (`itemtype` schema.org JobPosting) with
|
||||
`datePosted` and the address; `detail` reads the description, the date and the
|
||||
location with its country from it. Novo Nordisk's pages have none: the
|
||||
places with their country from it; a role at several places repeats the
|
||||
`jobLocation` block, once per place. Novo Nordisk's pages have none: the
|
||||
description is still in `itemprop="description"`, and the listing's date and
|
||||
location stand.
|
||||
"""
|
||||
@@ -51,6 +52,7 @@ from urllib.parse import urljoin, urlsplit
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, is_web_url, only, parse_dt
|
||||
|
||||
NAME = "successfactors"
|
||||
@@ -75,6 +77,12 @@ PATTERNS = (
|
||||
# robots.txt rules that name it.
|
||||
KEEP_CASE = True
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", text="detail", complete="stated", places="many",
|
||||
fields=Fields(posted="trusted", country="stated"),
|
||||
robots="read: robots.txt allows /search/ and /job/ (checked 2026-09-29)",
|
||||
)
|
||||
|
||||
#: A public DNS name in lower case with a letter-only last label, so an address
|
||||
#: (`127.0.0.1`) or a single word (`localhost`) never names a site, and an
|
||||
#: optional prefix of one or more path segments. `ats._get` refuses the local
|
||||
@@ -182,10 +190,6 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{host}{prefix}/search/"
|
||||
|
||||
|
||||
def robots_page(slug: str) -> str:
|
||||
return careers_url(slug)
|
||||
|
||||
|
||||
def _search_url(slug: str, start: int) -> str:
|
||||
host, prefix = _parts(slug)
|
||||
return f"https://{host}{prefix}/search/?q=&locationsearch=&startrow={start}"
|
||||
@@ -291,7 +295,7 @@ def _entries(text: str) -> list[dict[str, Any]]:
|
||||
return out
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
"""One search page. The cursor is `(start row, first role of the page
|
||||
before)`: the next start row is what this page returned, and a page that
|
||||
starts with the same role as the last one is the site ignoring `startrow`,
|
||||
@@ -329,6 +333,7 @@ def rows(decoded: str, slug: str) -> list[Row]:
|
||||
out.append({
|
||||
"source_id": entry["id"],
|
||||
"title": entry["title"],
|
||||
"places": [{"text": entry["place"], "remote": None}] if entry["place"] else [],
|
||||
"location": entry["place"],
|
||||
"url": url,
|
||||
"posted": _date(entry["date"]),
|
||||
@@ -368,6 +373,19 @@ def _posted(value: str) -> datetime | None:
|
||||
return parse_dt(value)
|
||||
|
||||
|
||||
def _country_code(meta: dict[str, str]) -> str:
|
||||
"""The address's country as an ISO code: `addressCountry`, or the code that
|
||||
`_place` reads in a `streetAddress`; '' for neither."""
|
||||
code = meta.get("addressCountry", "").strip().upper()
|
||||
if len(code) == 2:
|
||||
return code
|
||||
parts = [part.strip() for part in meta.get("streetAddress", "").split(",")]
|
||||
for i in range(len(parts) - 1, 0, -1):
|
||||
if len(parts) - i <= 2 and parts[i] in _COUNTRIES:
|
||||
return parts[i]
|
||||
return ""
|
||||
|
||||
|
||||
def _location(meta: dict[str, str]) -> str:
|
||||
"""The address as "City, Country". Vestas and Demant state
|
||||
`addressLocality` and `addressCountry` (a code), the other sites one
|
||||
@@ -386,7 +404,7 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
"""A role's own page: `description` from the block marked
|
||||
`itemprop="description"`, which Novo Nordisk's pages have without the
|
||||
microdata around it, and, from a page that has the `JobPosting` microdata,
|
||||
`posted` (`datePosted`) and `location` with its country. A page that
|
||||
`posted` (`datePosted`) and every place with the country's code. A page that
|
||||
is not a role's (the site answers 200 for a closed one with its search) has
|
||||
no description block and gives an empty answer."""
|
||||
text = get(row["url"]).decode("utf-8", "replace")
|
||||
@@ -402,6 +420,25 @@ def detail(get: Get, slug: str, row: Row) -> dict[str, Any]:
|
||||
meta = {name: html.unescape(value) for name, value in _META.findall(text)}
|
||||
if posted := _posted(meta.get("datePosted", "")):
|
||||
out["posted"] = posted
|
||||
if place := _location(meta):
|
||||
out["location"] = place
|
||||
addresses = _addresses(text) or [meta]
|
||||
places: list[Place] = []
|
||||
for address in addresses:
|
||||
if (place := _location(address)) and place not in (p["text"] for p in places):
|
||||
places.append({"text": place, "remote": None})
|
||||
if places:
|
||||
out["places"] = places
|
||||
out["location"] = "; ".join(p["text"] for p in places)
|
||||
codes = {_country_code(address) for address in addresses}
|
||||
if len(codes) == 1 and (code := next(iter(codes))):
|
||||
out["country"] = code
|
||||
return out
|
||||
|
||||
|
||||
def _addresses(text: str) -> list[dict[str, str]]:
|
||||
"""The microdata of each `jobLocation` block, one dict of `itemprop` ->
|
||||
content per place. A role at several places repeats the block."""
|
||||
found = []
|
||||
for match in re.finditer(r'<(?:span|div)\b[^>]*\bitemprop="jobLocation"', text):
|
||||
block = _element(text, match.start())
|
||||
found.append({name: html.unescape(value) for name, value in _META.findall(block)})
|
||||
return found
|
||||
@@ -16,6 +16,7 @@ from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, is_web_url, only, parse_dt
|
||||
|
||||
NAME = "teamtailor"
|
||||
@@ -28,6 +29,12 @@ PATTERNS = (
|
||||
r"cdn\.teamtailor\.com|teamtailor-cdn|teamtailor\.com/assets",
|
||||
)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", page_size=50, text="listing", complete="end",
|
||||
places="many", fields=Fields(posted="trusted", remote="stated"),
|
||||
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
||||
)
|
||||
|
||||
#: The page size, asked for as `per_page`. A feed with neither parameter
|
||||
#: answers with every role (73 of 73 at Shine, 2026-09-29), but says nowhere
|
||||
#: that it is the whole list, so this reads by page to an empty one;
|
||||
@@ -80,7 +87,7 @@ def probe_ok(body: bytes) -> bool:
|
||||
return b"<item>" in body
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
offset = int(cursor or 0)
|
||||
items = _items(get(f"https://{site(slug)}/jobs.rss?per_page={PAGE_SIZE}&offset={offset}"))
|
||||
results = [{"id": item.findtext("guid") or item.findtext("link") or ""} for item in items]
|
||||
@@ -106,32 +113,36 @@ def rows(items: list[ET.Element], slug: str) -> list[Row]:
|
||||
own domain), a `guid` uuid, `pubDate`, the HTML `description` in full,
|
||||
`remoteStatus` (fully, hybrid, onsite, none or temporary), and, in the
|
||||
`tt:` namespace, `locations` (a list: `city` and `country` each, `name` free
|
||||
text), `department` and `role`, either of which may be empty. `place` joins
|
||||
the distinct locations with "; ", which `country_of` reads a location at a
|
||||
time. No pay is stated anywhere in the feed."""
|
||||
text), `department` and `role`, either of which may be empty. `places` keeps
|
||||
the distinct locations, and `location` joins them with "; ". A place is
|
||||
remote or an office as far as the role's `remoteStatus` says. No pay is
|
||||
stated anywhere in the feed."""
|
||||
out = []
|
||||
for item in items:
|
||||
title = (item.findtext("title") or "").strip()
|
||||
url = (item.findtext("link") or "").strip()
|
||||
if not title or not is_web_url(url):
|
||||
continue
|
||||
places: list[str] = []
|
||||
status = (item.findtext("remoteStatus") or "").strip()
|
||||
remote = {"fully": True, "hybrid": False, "onsite": False}.get(status)
|
||||
places: list[Place] = []
|
||||
for loc in item.findall(f"{_TT}locations/{_TT}location"):
|
||||
city = (loc.findtext(f"{_TT}city") or loc.findtext(f"{_TT}name") or "").strip()
|
||||
country = (loc.findtext(f"{_TT}country") or "").strip()
|
||||
place = city if country == city else ", ".join(p for p in (city, country) if p)
|
||||
if place and place not in places:
|
||||
places.append(place)
|
||||
if place and place not in (p["text"] for p in places):
|
||||
places.append({"text": place, "remote": remote})
|
||||
out.append({
|
||||
"source_id": (item.findtext("guid") or url).strip(),
|
||||
"title": title,
|
||||
"location": "; ".join(places),
|
||||
"places": places,
|
||||
"location": "; ".join(p["text"] for p in places),
|
||||
"url": url,
|
||||
"posted": parse_dt(item.findtext("pubDate")),
|
||||
"department": ((item.findtext(f"{_TT}department") or "").strip()
|
||||
or (item.findtext(f"{_TT}role") or "").strip()),
|
||||
"description": html.unescape(strip_html(item.findtext("description") or "")),
|
||||
"remote": _REMOTE.get((item.findtext("remoteStatus") or "").strip()),
|
||||
"remote": _REMOTE.get(status),
|
||||
"salary_text": "", # Teamtailor's feed states no pay at all
|
||||
})
|
||||
return out
|
||||
@@ -8,11 +8,15 @@ board with roles was seen; jobhunt-hq did not read Workable.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from ._contract import Ask, Fields, Place, Reads
|
||||
from ._shared import Get, Page, Row, only, parse_dt, path_slug_ok
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
NAME = "workable"
|
||||
LABEL = "Workable"
|
||||
RANK = 40
|
||||
@@ -21,8 +25,20 @@ PATTERNS = (
|
||||
r"https?://(?!apply\.|www\.)([a-z0-9-]+)\.workable\.com",
|
||||
)
|
||||
|
||||
READS = Reads(
|
||||
scope="board", listing="paged", page_size=10, text="none", complete="stated",
|
||||
places="many",
|
||||
fields=Fields(posted="trusted", remote="stated", country="stated", employment="stated"),
|
||||
robots="api: no robots.txt check needed (public board API), 2026-09-30",
|
||||
)
|
||||
|
||||
_API = "apply.workable.com"
|
||||
|
||||
#: `type` -> the app's employment words; a type not listed is logged at debug
|
||||
#: level so the table can grow.
|
||||
_EMPLOYMENT = {"full": "full_time", "part": "part_time", "contract": "contract",
|
||||
"temporary": "temporary", "internship": "internship"}
|
||||
|
||||
# No probe: Workable's API sits behind a rate limit that a run of guesses
|
||||
# trips, and a Workable site links its board plainly anyway.
|
||||
|
||||
@@ -39,7 +55,7 @@ def careers_url(slug: str) -> str:
|
||||
return f"https://{_API}/{slug}"
|
||||
|
||||
|
||||
def page(get: Get, slug: str, cursor: Any) -> Page:
|
||||
def page(get: Get, slug: str, cursor: Any, ask: Ask = Ask()) -> Page:
|
||||
"""One POST of the list; the next page is the same POST with
|
||||
`{"token": nextPage}`, and the last page has no `nextPage`."""
|
||||
url = f"https://{_API}/api/v3/accounts/{slug}/jobs"
|
||||
@@ -51,6 +67,28 @@ def parse(body: bytes, slug: str) -> list[Row]:
|
||||
return rows(json.loads(body), slug)
|
||||
|
||||
|
||||
def _places(job: dict[str, Any], remote: bool) -> tuple[list[Place], set[str]]:
|
||||
"""Every place of a role and the countries' codes among them. `locations`
|
||||
lists them (city, region, country; `hidden` ones are stated too), and
|
||||
`location` is the first alone, the fallback for a role that lists none.
|
||||
A place is remote when the role is."""
|
||||
found: list[Place] = []
|
||||
codes: set[str] = set()
|
||||
listed = [loc for loc in job.get("locations") or [] if isinstance(loc, dict)]
|
||||
for loc in listed or [job.get("location") or {}]:
|
||||
parts: list[str] = []
|
||||
for part in (loc.get("city"), loc.get("region"), loc.get("country")):
|
||||
part = str(part or "").strip()
|
||||
if part and part not in parts:
|
||||
parts.append(part)
|
||||
text = ", ".join(parts)
|
||||
if text and text not in (p["text"] for p in found):
|
||||
found.append({"text": text, "remote": remote})
|
||||
if code := str(loc.get("countryCode") or "").strip().upper():
|
||||
codes.add(code)
|
||||
return found, codes
|
||||
|
||||
|
||||
def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
"""One page of POST https://apply.workable.com/api/v3/accounts/{slug}/jobs
|
||||
-> `{"total": int, "results": [...], "nextPage": token}`, as Hugging
|
||||
@@ -58,28 +96,35 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
the job page is `https://apply.workable.com/{slug}/j/{shortcode}/`, and
|
||||
the description is only on the per-job endpoint, one request per role,
|
||||
so `description` stays empty here as it does for SmartRecruiters.
|
||||
`location` is an object and `department` a list; `remote` is a flag
|
||||
beside `workplace` (remote, hybrid, on_site)."""
|
||||
`location` is the first place and `locations` all of them; `department`
|
||||
is a list; `remote` is a flag beside `workplace` (remote, hybrid,
|
||||
on_site); `type` is the hours or the contract (full, part, ...)."""
|
||||
out = []
|
||||
for j in data.get("results") or []:
|
||||
title = (j.get("title") or "").strip()
|
||||
shortcode = (j.get("shortcode") or "").strip()
|
||||
if not title or not shortcode:
|
||||
continue
|
||||
loc = j.get("location") or {}
|
||||
location = ", ".join(p for p in (loc.get("city"), loc.get("region"), loc.get("country")) if p)
|
||||
remote = bool(j.get("remote")) or j.get("workplace") == "remote"
|
||||
places, codes = _places(j, remote)
|
||||
kind = str(j.get("type") or "").strip().lower()
|
||||
if kind and kind not in _EMPLOYMENT:
|
||||
log.debug("workable: unknown type %r", kind)
|
||||
dept = j.get("department") or ""
|
||||
if isinstance(dept, list):
|
||||
dept = ", ".join(d for d in dept if d)
|
||||
out.append({
|
||||
"source_id": str(j.get("id") or shortcode),
|
||||
"title": title,
|
||||
"location": location,
|
||||
"places": places,
|
||||
"location": "; ".join(p["text"] for p in places),
|
||||
"url": f"https://{_API}/{slug}/j/{shortcode}/",
|
||||
"posted": parse_dt(j.get("published")),
|
||||
"department": dept.strip(),
|
||||
"description": "",
|
||||
"remote": bool(j.get("remote")) or j.get("workplace") == "remote",
|
||||
"remote": remote,
|
||||
"salary_text": "", # Workable's list endpoint states no pay at all
|
||||
"country": next(iter(codes)) if len(codes) == 1 else None,
|
||||
"employment": _EMPLOYMENT.get(kind),
|
||||
})
|
||||
return out
|
||||
+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