Every import, test and live doc follows the new path; behaviour is unchanged. tests/test_atshosts.py becomes tests/test_readers.py. plan-readers.md and review-ingest.md keep the old name, since they describe the state before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
128 lines
4.8 KiB
Python
128 lines
4.8 KiB
Python
"""Rippling: `rippling:<board slug>` for ats.rippling.com/<slug>, the whole
|
|
board in one JSON array, the description on each role's own record.
|
|
|
|
Written from Prisma's board (`prisma-careers`, two roles) and Rippling's own
|
|
(`rippling`, 326 roles) on 2026-09-29. The careers site's script reads the
|
|
public board API, `api.rippling.com/platform/api/ats/v1/board/<slug>/jobs`,
|
|
which needs no key. The slug is case-sensitive (`Prisma-Careers` is "Job
|
|
Board not found").
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import html
|
|
import json
|
|
import re
|
|
from collections.abc import Callable
|
|
from typing import Any
|
|
|
|
from desk.sources import strip_html
|
|
|
|
from ._shared import Get, Row, parse_dt, yearly_amount
|
|
|
|
NAME = "rippling"
|
|
LABEL = "Rippling"
|
|
KEEP_CASE = True
|
|
PATTERNS = (
|
|
r"ats\.rippling\.com/([A-Za-z0-9][A-Za-z0-9_-]*)",
|
|
r"api\.rippling\.com/platform/api/ats/v1/board/([A-Za-z0-9][A-Za-z0-9_-]*)",
|
|
)
|
|
|
|
_API = "api.rippling.com"
|
|
_SITE = "ats.rippling.com"
|
|
|
|
#: A slug is one path segment that starts with a letter or a digit, matched
|
|
#: whole; it is also what discovery's patterns take.
|
|
_SLUG = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*")
|
|
|
|
#: A role's id in the board's own links.
|
|
_UUID = re.compile(r"[0-9A-Za-z-]{8,64}")
|
|
|
|
|
|
def slug_ok(slug: str) -> bool:
|
|
return bool(_SLUG.fullmatch(slug))
|
|
|
|
|
|
def allowed(slug: str) -> Callable[[str], bool]:
|
|
return lambda host: host.lower() in (_API, _SITE)
|
|
|
|
|
|
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:
|
|
return f"{_board(slug)}/jobs"
|
|
|
|
|
|
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
|
|
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]] = {}
|
|
for entry in data:
|
|
job_id = str(entry.get("uuid") or "").strip()
|
|
title = (entry.get("name") or "").strip()
|
|
if not title or not _UUID.fullmatch(job_id):
|
|
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)
|
|
roles.setdefault(job_id, {
|
|
"source_id": job_id,
|
|
"title": title,
|
|
"url": f"https://{_SITE}/{slug}/jobs/{job_id}",
|
|
"posted": None,
|
|
"department": str(((entry.get("department") or {}).get("label")) or "").strip(),
|
|
"description": "",
|
|
"salary_text": "", # the board's list states no pay
|
|
})
|
|
for job_id, row in roles.items():
|
|
row["location"] = "; ".join(places[job_id])
|
|
row["remote"] = True if places[job_id] and all(
|
|
p.lower().startswith("remote") for p in places[job_id]) else None
|
|
return list(roles.values())
|
|
|
|
|
|
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`,
|
|
`createdOn` for `posted`, and `payRangeDetails`, a range per pay zone.
|
|
The columns are only filled for exactly one yearly range, as Greenhouse's
|
|
are: with several zones there is no telling which one the role has."""
|
|
data = json.loads(get(f"{_board(slug)}/jobs/{row['source_id']}"))
|
|
text = data.get("description") or {}
|
|
found: 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))
|
|
ranges = data.get("payRangeDetails") or []
|
|
if len(ranges) == 1:
|
|
pay = ranges[0]
|
|
lo, hi, currency = yearly_amount(pay.get("rangeStart"), pay.get("rangeEnd"),
|
|
pay.get("currency"), pay.get("frequency"),
|
|
{"YEAR": 1, "MONTH": 12})
|
|
if currency:
|
|
found |= {"salary_min": lo, "salary_max": hi, "currency": currency}
|
|
return found
|