Skip to main content

EnrichedNow Python library

CI

The official Python library for the EnrichedNow API: run scrapers, read their records, and query the job-postings datasets.

  • Sync and async clients with the same surface
  • Typed models and typed errors; ships py.typed
  • Automatic pagination, retries with backoff, and waiting for a run to end
  • One runtime dependency: httpx
  • Python 3.9+

Install

pip install enrichednow

Quickstart

Create an API key in the console under API keys and put it in the environment:

export ENRICHEDNOW_API_KEY="en_live_..."
from enrichednow import EnrichedNow

client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY

result = client.scrape("ats.board", {"board_url": "https://boards.greenhouse.io/acme"})

print(result.run.status, result.run.record_count)
for record in result.records:
    print(record["title"])

scrape starts a run, waits for it to end and hands back the run with its records. Records are fetched page by page as you iterate.

The client

from enrichednow import EnrichedNow

client = EnrichedNow(
    api_key="en_live_...",                    # default: the ENRICHEDNOW_API_KEY environment variable
    base_url="https://api.enrichednow.com",   # default
    timeout=30.0,                             # seconds for one HTTP request (or an httpx.Timeout)
    max_retries=2,                            # see "Retries"
)

Without a key, the constructor raises MissingAPIKeyError. Keep the key out of your code.

The client holds a connection pool. Use it as a context manager, or call client.close(), when you are done:

with EnrichedNow() as client:
    print(client.health().status)  # "ok"

To bring your own httpx.Client (custom transport or TLS settings), pass http_client=.... The library does not close a client it did not create.

Scrapers

for scraper in client.scrapers.list():          # the catalogue
    print(scraper.id, scraper.title, scraper.unit_cost, "units a", scraper.billing_unit)

scraper = client.scrapers.get("ats.board")      # with JSON Schemas
print(scraper.input_schema)                     # what goes in `input`
print(scraper.record_schema)                    # the shape of one record

Start a run

run = client.scrapers.run("careers.company", {"domain": "acme.com"})
print(run.id, run.status)                       # "queued"

wait (0 to 60 seconds) asks the API to hold the request open until the run ends or the time is up. Either way you get the run as it is at that moment, so treat queued and running as ordinary answers:

run = client.scrapers.run("careers.company", {"domain": "acme.com"}, wait=60)
if run.is_active:
    run = client.runs.wait(run.id)

The HTTP timeout of that one request is raised to wait + 30 seconds when yours is shorter.

Runs

run = client.runs.get("run_...")                # the run as it is now
run = client.runs.wait("run_...", timeout=600, poll_interval=2)   # poll until it has ended
run = client.runs.cancel("run_...")             # ask it to stop

for run in client.runs.list(scraper_id="ats.board", status="ok"):
    print(run.id, run.created_at, run.record_count)

unit_cost is what the scraper costs: units_per_request for one billed per request, units_per_record (each record) for one billed per record.

A Run has id, scraper_id, scraper_version, status, reason, input, record_count, units, units_per_request and units_per_record (its rate, fixed when it started), diagnostics, created_at, started_at and finished_at, plus a few helpers:

run.is_active queued or running
run.is_terminal the run has ended, however it ended
run.succeeded ended ok or partial
run.failed ended failed, unsupported or cancelled
run.raise_for_status() raises RunFailedError when run.failed; otherwise returns the run

runs.wait returns the run however it ended and raises WaitTimeoutError if it is still going after timeout seconds. The run itself carries on; the error has it on .run.

Cancelling is cooperative: a run that was already finishing may still complete. Read the status it ended with.

Records

for record in client.runs.records(run.id):      # every record, page after page
    ...

Records are plain dicts in the shape of the scraper's record_schema. They are kept for 7 days after the run ended; after that the list is empty and page.expired is True.

CSV and NDJSON, written by the API

with open("jobs.csv", "wb") as out:
    for chunk in client.runs.export_all(run.id, "csv"):  # every page; the header row once
        out.write(chunk)

page = client.runs.export(run.id, "ndjson", limit=500)  # one page: page.content, page.next_cursor, page.expired

The CSV has a column for each field of the scraper's record schema, in its order, so every page of every run of a scraper has the same columns; a nested object becomes parent.child columns, a list one cell of JSON, and a cell a spreadsheet would run as a formula starts with an apostrophe.

Files

A scraper that makes a file (a screenshot) puts its address in the record. client.runs.file(run.id, "screenshot.png") returns its bytes, read with your key.

Waiting longer in one call

wait holds a request open until the run ends, up to 300 seconds, on starting a run and on reading one: client.scrapers.run(..., wait=120), client.runs.get(run.id, wait=120). runs.list also takes api_key_id, from_ and to.

The one-liner

result = client.scrape(
    "ats.board",
    {"board_url": "https://boards.greenhouse.io/acme"},
    timeout=600,             # give up waiting after this many seconds (None: wait as long as it takes)
    poll_interval=2,
    raise_on_failure=True,
)
result.run        # the Run, ended
result.records    # iterable of records; `for record in result` works too

A run that ends failed, unsupported or cancelled raises RunFailedError with .status, .reason and .run. Pass raise_on_failure=False to get the result instead. A run that ends partial is returned: it has records, and result.run.reason says why it is not complete.

from enrichednow import RunFailedError

try:
    result = client.scrape("careers.company", {"domain": "acme.com"})
except RunFailedError as error:
    print(error.status, error.reason, error.run.id)

Webhooks

Instead of polling, have a URL of yours told when a run ends. An endpoint is an https URL and the events it wants: run.succeeded (the status ok), run.partial, run.failed, run.unsupported, run.cancelled.

endpoint = client.webhooks.create(
    "https://example.com/hooks/enrichednow",
    ["run.succeeded", "run.partial", "run.failed"],
    description="production",
)
print(endpoint.id, endpoint.secret)             # the signing secret (whsec_...) is shown only here: store it
client.webhooks.list()                          # .endpoints (iterable) and .run_secret_set
client.webhooks.get("whk_...")
client.webhooks.update("whk_...", enabled=False)                # any of url, events, description, enabled
client.webhooks.rotate_secret("whk_...").secret                 # a new secret; the old one stops at once
client.webhooks.delete("whk_...")

for delivery in client.webhooks.deliveries.list(status="failed"):   # the delivery log, newest first
    print(delivery.id, delivery.event, delivery.attempts, delivery.error)
client.webhooks.deliveries.resend("whd_...")                    # send one again

Verify a request

Anybody who learns your URL can post to it, so check the signature before you act on a request. verify_webhook needs no client and makes no request. Give it the body exactly as it arrived, as raw bytes, before any JSON parsing:

import os

from flask import Flask, request

from enrichednow import WebhookVerificationError, parse_webhook

app = Flask(__name__)
SECRET = os.environ["ENRICHEDNOW_WEBHOOK_SECRET"]


@app.post("/hooks/enrichednow")
def run_ended():
    try:
        event = parse_webhook(
            SECRET,
            request.headers.get("X-Webhook-Timestamp", ""),
            request.get_data(),                                 # the raw bytes
            request.headers.get("X-Webhook-Signature", ""),
        )
    except WebhookVerificationError:
        return "", 400
    print(event.id, event.type, event.run.id, event.run.record_count)
    return "", 204

parse_webhook returns a WebhookEvent (id, type, created_at, run) and raises WebhookVerificationError for a request that does not verify. verify_webhook(secret, timestamp, body, signature) takes the same arguments and returns True or False. Both compare in constant time and refuse a timestamp more than 5 minutes from now (tolerance_s=300).

An event can arrive more than once, and is sent again when you resend a delivery; event.id is the same every time, so use it to ignore a repeat. Answer with a 2xx quickly and do the work afterwards.

A webhook for one run

client.webhooks.create_run_secret().secret      # once for the account; shown only here
run = client.scrapers.run("careers.company", {"domain": "acme.com"}, webhook_url="https://example.com/hooks/run-done")

webhook_url is told when that run ends, whichever way it ends, beside your endpoints. client.scrape() takes it too. What is sent there is signed with the account's run secret; verify it the same way.

Usage

from datetime import date

usage = client.usage.get()                      # this calendar month (UTC), by day
print(usage.total_units, "of", usage.allowance_units)

usage = client.usage.get(from_=date(2026, 11, 1), to="2026-11-18", group_by="scraper")
for row in usage.rows:
    print(row.key, row.units, row.runs)

client.usage.get(product="data")                # the data allowance and its usage

group_by is day, scraper or product. The period's first day is from_ here (from in the API, a reserved word in Python); the same goes for usage.period.from_. usage.unmetered is True for an account with no unit limit.

Where the account stands

Every answer about runs carries the account's units and runs in progress in its headers. The client keeps the last one it saw, and usage.standing() asks for it:

standing = client.usage.standing()
print(standing.units_remaining, standing.units_topup, standing.units_reset, standing.runs_remaining)
print(standing.units_available)                 # what is left of the allowance, and the top-up units

client.scrapers.run("ats.board", {...})
client.standing                                 # as that answer said it, without another call

Datasets

The datasets reads live under client.data. Each record returned costs one data unit, so stop iterating when you have what you need.

# Search postings
for posting in client.data.postings.list(title="software engineer", country="DE", status="open", limit=200):
    print(posting.title_clean, posting.company.name, posting.location.city, posting.url)

# One posting, with its description and history
posting = client.data.postings.get("...")
print(posting.description, posting.history.events)

# Companies
for company in client.data.companies.list(q="acme", ats="greenhouse"):
    print(company.domain, company.postings.open)

company = client.data.companies.get("acme.com")
for posting in client.data.companies.postings("acme.com", status="open"):
    ...

Posting filters: company_domain, title, location, country, remote, employment_type, seniority, function, status, source, provenance, unmatched, posted_from, posted_to, first_seen_from, first_seen_to, last_seen_from, last_seen_to, sort. Dates and times can be date / datetime objects or ISO 8601 strings; provenance can be a string or a list (["feed", "page"]).

To follow what is new, ask for what changed since you last asked:

new = client.data.postings.list(first_seen_from=last_checked)
seen = client.data.postings.list(sort="last_seen_at", last_seen_from=last_checked)

Two fields are renamed because the models keep the original JSON on .raw: the API's location.raw and salary.raw are location.raw_text and salary.raw_text.

Pagination

Every list returns a page. Iterating it yields its items and then those of every later page, fetching each page as it is reached:

for run in client.runs.list(limit=100):         # `limit` is the size of a page
    ...

everything = client.runs.records(run_id, limit=1000).to_list()

For one page at a time:

page = client.runs.records(run_id, limit=500)
page.items                # this page's records
page.next_cursor          # None on the last page
page.has_next_page()
page = page.next_page()   # None on the last page

for page in client.data.postings.list(status="open").iter_pages():
    save(page.items)

To resume later, keep page.next_cursor and pass it back as cursor= with the same other arguments. A cursor is an opaque string; pass it back unchanged.

Errors

Two different things can go wrong, and they are reported differently:

  • The request failed: the API answered 4xx or 5xx, or did not answer. The library raises.
  • The scrape failed: the request was fine, and the run ended failed or unsupported. runs.get and runs.wait return that run; scrape() and run.raise_for_status() raise RunFailedError.
EnrichedNowError
├── MissingAPIKeyError
├── APIConnectionError              the request never got an answer
│   └── APITimeoutError
├── APIError                        the API answered with an error
│   ├── AuthenticationError         401 unauthorized
│   │   └── PermissionDeniedError   403 forbidden
│   ├── NotFoundError               404 not_found
│   ├── RateLimitError              429 too_many_runs, rate_limited
│   ├── ValidationError             422 invalid_input, and any other 4xx
│   │   └── QuotaExceededError      402 quota_exceeded
│   │       └── LimitReachedError   402 limit_reached: the account's or the key's own spend limit
│   └── ServerError                 5xx internal, data_unavailable
├── RunFailedError                  a run ended failed, unsupported or cancelled
├── WaitTimeoutError                a run did not end within the time given
└── WebhookVerificationError        a webhook request did not verify (parse_webhook)

An APIError carries what the API said:

import enrichednow

try:
    client.scrapers.run("ats.board", {"board": "acme"})
except enrichednow.LimitReachedError as error:          # before QuotaExceededError: it is one
    print(error.scope, error.limit_units, error.used_units)   # "account" or "key"; raise the limit in the console
except enrichednow.QuotaExceededError as error:
    print(error.used_units, error.allowance_units)
except enrichednow.ValidationError as error:
    print(error.status_code)    # 422
    print(error.code)           # "invalid_input"  <- match on this
    print(error.message)        # a sentence for a person
    print(error.fields)         # [{"path": "input.board_url", "message": "Field required"}, ...]
except enrichednow.RateLimitError as error:
    print(error.code)           # "too_many_runs" or "rate_limited"
    print(error.active_runs, error.max_concurrent_runs, error.retry_after)
except enrichednow.APIError as error:
    print(error.status_code, error.code, error.message, error.details, error.request_id)
Attribute
status_code The HTTP status.
code The API's stable error code.
message A sentence for a person. Show it or log it; do not parse it.
details Always a dict. fields for invalid_input; used_units and allowance_units for quota_exceeded (and topup_units and units_needed when starting a run was refused); scope, limit_units, used_units, units_needed (and key_id for a key) for limit_reached; active_runs and max_concurrent_runs for too_many_runs.
reason details["reason"] when the API gives one, such as email_not_verified on a 403.
request_id The request id, when the answer has one; otherwise None.
body, response The parsed body and the httpx.Response.

Retries

A request that fails in a way worth retrying is sent again, up to max_retries times (default 2), with exponential backoff and jitter: about half a second, then a second, then two, up to eight.

Failure Retried
The connection failed or the request timed out Yes
429 Yes, after the seconds in Retry-After when the answer has it
5xx Yes
Any other 4xx No: the same request would get the same answer

A Retry-After longer than 60 seconds is not waited for: the RateLimitError is raised, with the wait on .retry_after.

Starting a run is safe to repeat too. scrapers.run() and scrape() send an Idempotency-Key with the request, a new one for each call, so a retry after a timeout or a 5xx gets the run the first attempt started and never a second one. To make a call of your own repeatable (a job that may be restarted, say), pass your own key: client.scrape("ats.board", input, idempotency_key="import-2026-11-19-acme"). For 24 hours the same key with the same request gives the same run; the same key with a different request raises ConflictError.

webhooks.create() and webhooks.deliveries.resend() are the exception: they are sent again only when the API cannot have acted (the connection was never made, or the answer was 429), because a repeat would add a second endpoint, or queue the delivery twice.

client = EnrichedNow(max_retries=0)   # never retry
client = EnrichedNow(max_retries=5)

Async

AsyncEnrichedNow has the same resources, methods and arguments. Every call is awaited; lists are iterated with async for.

import asyncio
from enrichednow import AsyncEnrichedNow


async def main() -> None:
    async with AsyncEnrichedNow() as client:
        result = await client.scrape("ats.board", {"board_url": "https://boards.greenhouse.io/acme"})
        async for record in result.records:
            print(record["title"])

        run = await client.scrapers.run("careers.company", {"domain": "acme.com"}, wait=60)
        run = await client.runs.wait(run.id)

        async for posting in client.data.postings.list(status="open"):   # every item, page after page
            ...

        page = await client.runs.list(limit=50)                           # or one page
        page = await page.next_page()

        records = await client.runs.records(run.id).to_list()


asyncio.run(main())

Models

Responses are frozen dataclasses with type hints. Timestamps are datetime objects (UTC), days are date objects. Every model keeps the JSON it came from on .raw (also .to_dict()), so a field the API adds later is there before this library knows its name, and never breaks parsing.

run = client.runs.get("run_...")
run.finished_at                 # datetime
run.diagnostics.facts           # dict
run.raw                         # the JSON object, as returned

Development

pip install -e ".[dev]"
pytest               # the tests
mypy                 # the strict type check
python -m build      # the wheel and the source distribution, into dist/ (pip install build)

The tests run against a mocked transport and make no network calls.

Licence

MIT. See LICENSE. To report a security problem, see SECURITY.md.

Metadata

Release files for enrichednow 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enrichednow 0.3.1
File Size Uploaded Provenance Actions
enrichednow-0.3.1.tar.gz 50.6 kB Without provenance Details for enrichednow-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for enrichednow 0.3.1
File Interpreter ABI Platform Actions
enrichednow-0.3.1-py3-none-any.whl Python 3 none any Details for enrichednow-0.3.1-py3-none-any.whl

Total release size: 88.4 kB

Release files / enrichednow-0.3.1.tar.gz

Download URL enrichednow-0.3.1.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
10c87ae762ed324a2697589d2bf5594023cf3aa71763158b1b3c971cc28b9477
BLAKE2b-256 checksum
How to use checksums
9fc78566a70a7a971bd4d65717a8fdc175111e8c6e088c7ed977e5d8292ff1a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / enrichednow-0.3.1-py3-none-any.whl

Download URL enrichednow-0.3.1-py3-none-any.whl
Size 37.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf0edf4d77b839d36fcd681a09071187a294b660845a2960e463aa595a521825
BLAKE2b-256 checksum
How to use checksums
dc8a3255004d75a755bd482fb85b6282e1fbd9332016f8c770cf9ce7c61b29aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for enrichednow 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page