Skip to main content

Nomad headless browser engine — Python SDK

Project description

Nomad SDK — Python

Nomad is a zero-overhead headless browser engine. 5 MB binary, 6 MB RSS, 550 req/s. This package connects to a running Nomad daemon over a Unix Domain Socket.

pip install nomad-sdk

Quickstart

Make sure the Nomad daemon is running:

MALLOC_ARENA_MAX=1 nomad-daemon &

Then scrape a page in 2 lines:

from nomad_sdk import NomadClient

with NomadClient() as client:
    page = client.navigate("https://news.ycombinator.com")
    print(f"Title: {page.title}")
    print(f"Links: {len(page.find_all(tag='a'))}")

API

NomadClient(socket_path="/tmp/nomad-daemon.sock")

Method Description
navigate(url, fmt=3) Fetch and parse a page
snapshot(tab_id) Get current page state without re-fetching
click(entity_id) Click an element by entity ID
input_text(entity_id, value) Type text into an input field
find(query) Find elements by role, tag, intent, text
evaluate(js) Execute arbitrary JavaScript
scroll(dx, dy) Scroll the viewport
resize(w, h) Resize the viewport
health() Daemon health info
get_action_log(tab_id) Tab action history

Output formats (fmt)

ID Name Use
0 RawBincode Machine IPC
1 JSON Debug
2 Markdown Human read
3 AgentJson LLM (full entities)
4 Summary LLM (~150 bytes)
5 TokenMinimal LLM (shortest)
6--10 Section/Accessibility/Reader/Form Specialized

Page methods

page.find_one(role="button", text="Sign In")  # first match
page.find_all(tag="a", intent="navigation")    # all matches

Example — Click a button

from nomad_sdk import NomadClient

with NomadClient() as client:
    page = client.navigate("https://example.com/login")
    btn = page.find_one(role="button", text="Submit")
    if btn:
        client.click(btn.id)

Requirements

  • Python ≥ 3.10
  • Nomad daemon running (UDS socket at /tmp/nomad-daemon.sock)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nomad_sdk-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nomad_sdk-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file nomad_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: nomad_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for nomad_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9656acbc2a6eb49608d6828975309a59af57e179152f1e36f558006e6dd36d6f
MD5 9331644e8e7ed7b8ba4efec44c82b382
BLAKE2b-256 fbd116e5e2376166b7dce80c1489acfeaed0a751ba55934cfe702a16c3cbc5c8

See more details on using hashes here.

File details

Details for the file nomad_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nomad_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for nomad_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b60bef421c342ef1c2bb33f85629ad2f133eb5e36fb3a909f100a8fedff723d
MD5 9e2b70c57180955fcf58cd97e8b794e2
BLAKE2b-256 6dab0f7f27d56135cfa52d8d9c933308395d1f2dc784744411c469f7faceb878

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page