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