Readers oracle to workday and the providers hand on the host's words; their word tables move to app/prep/hosts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a66aac95cf
commit
06eb929eaf
48 files changed
+460
-388
No files matched your search
+10
-21
@@ -8,14 +8,11 @@ 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, add_place, country_if_single, only, parse_dt, path_slug_ok, table_word
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
from ._shared import Get, Page, Row, add_place, only, parse_dt, path_slug_ok
|
||||
|
||||
NAME = "workable"
|
||||
LABEL = "Workable"
|
||||
@@ -28,17 +25,12 @@ PATTERNS = (
|
||||
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"),
|
||||
fields=Fields(posted="trusted", remote="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.
|
||||
|
||||
@@ -67,13 +59,12 @@ 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`
|
||||
def _places(job: dict[str, Any], remote: bool) -> list[Place]:
|
||||
"""Every place of a role. `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] = []
|
||||
@@ -83,9 +74,7 @@ def _places(job: dict[str, Any], remote: bool) -> tuple[list[Place], set[str]]:
|
||||
parts.append(part)
|
||||
text = ", ".join(parts)
|
||||
add_place(found, {"text": text, "remote": remote})
|
||||
if code := str(loc.get("countryCode") or "").strip().upper():
|
||||
codes.add(code)
|
||||
return found, codes
|
||||
return found
|
||||
|
||||
|
||||
def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
@@ -104,8 +93,9 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
shortcode = (j.get("shortcode") or "").strip()
|
||||
if not title or not shortcode:
|
||||
continue
|
||||
remote = bool(j.get("remote")) or j.get("workplace") == "remote"
|
||||
places, codes = _places(j, remote)
|
||||
workplace = str(j.get("workplace") or "").strip()
|
||||
remote = bool(j.get("remote")) or workplace == "remote"
|
||||
places = _places(j, remote)
|
||||
dept = j.get("department") or ""
|
||||
if isinstance(dept, list):
|
||||
dept = ", ".join(d for d in dept if d)
|
||||
@@ -118,9 +108,8 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
"posted": parse_dt(j.get("published")),
|
||||
"department": dept.strip(),
|
||||
"description": "",
|
||||
"remote": remote,
|
||||
"remote": workplace or j.get("remote"),
|
||||
"salary_text": "", # Workable's list endpoint states no pay at all
|
||||
"country": country_if_single(codes),
|
||||
"employment": table_word(_EMPLOYMENT, j.get("type"), log, "type"),
|
||||
"employment": str(j.get("type") or "").strip() or None,
|
||||
})
|
||||
return out
|
||||
Reference in new issue
Block a user