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
@@ -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
|
||||
Reference in new issue
Block a user