Skip to main content

Python wrapper for the ROM browser-like runtime

Project description

rom-runtime

Python bindings for the ROM browser-like runtime.

This package exposes a thin Python API on top of ROM:

  • eval()
  • eval_async()
  • eval_json()
  • surface_snapshot()
  • fingerprint_probe()
  • run_fingerprintjs_harness()
  • fingerprintjs_version()

It prefers a native PyO3 extension when available and falls back to the ROM CLI bridge otherwise.

Install

pip install rom-runtime

Usage

from rom import RomRuntime, has_native_binding

runtime = RomRuntime(
    {
        "href": "https://example.test/",
        "referrer": "https://referrer.example/",
        "cors_enabled": False,
        "proxy_url": None,
    }
)
href = runtime.eval_async("(async () => location.href)()")
snapshot = runtime.surface_snapshot()

print("native:", has_native_binding())
print(href)
print(snapshot["fetch"])

runtime.eval_async("(async () => { globalThis.__rom_value = 42; return 'ok'; })()")
print(runtime.eval_async("(async () => String(globalThis.__rom_value))()"))

Config keys use the Rust runtime field names, so use snake_case such as cors_enabled and proxy_url. cors_enabled is False by default. When the native extension is loaded, one RomRuntime instance keeps JS globals alive across multiple eval() and eval_async() calls. For cookie seeding, the wrapper accepts serialized cookie_store, a raw cookie header string, or a cookies alias with string/object/array inputs and normalizes them automatically. For storage seeding, the wrapper accepts local_storage and session_storage as serialized JSON objects, Python dicts, or entry arrays such as [('VerifyAuthToken', 'seeded')]. The default navigator surface is Chrome-like, including navigator.userAgent, navigator.vendor, and navigator.userAgentData.

Optional native build from source

python -m pip install maturin
python -m maturin build --manifest-path bindings/gom-python/Cargo.toml --release

Tagged GitHub releases build and publish wheels for Linux, Windows, and macOS, plus an sdist for source installs.

Common methods

  • eval()
  • eval_async()
  • eval_json()
  • surface_snapshot()
  • fingerprint_probe()
  • run_fingerprintjs_harness()
  • fingerprintjs_version()

Environment

  • ROM_FORCE_CLI_BRIDGE=1: disable the native path and force CLI fallback
  • ROM_BRIDGE_BIN: explicit path to the rom_bridge executable
  • ROM_BRIDGE_CWD: working directory used by the CLI fallback

More docs

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

rom_runtime-0.0.11.tar.gz (149.2 kB view details)

Uploaded Source

Built Distributions

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

rom_runtime-0.0.11-cp39-abi3-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

rom_runtime-0.0.11-cp39-abi3-manylinux_2_38_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.38+ x86-64

rom_runtime-0.0.11-cp39-abi3-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rom_runtime-0.0.11-cp39-abi3-macosx_10_12_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file rom_runtime-0.0.11.tar.gz.

File metadata

  • Download URL: rom_runtime-0.0.11.tar.gz
  • Upload date:
  • Size: 149.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rom_runtime-0.0.11.tar.gz
Algorithm Hash digest
SHA256 368225bf0dfa4341b71db6721817f02a0c36f62c6ed0d50b28cc047ab3f4932c
MD5 d9488a714472ac78209cd1cd1860b09e
BLAKE2b-256 7c70677ad92717e3b4b596c19ff729e29aaf3263735bc446b1b0c3ada1c588b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.11.tar.gz:

Publisher: release-bindings.yml on Rxflex/rom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rom_runtime-0.0.11-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rom_runtime-0.0.11-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rom_runtime-0.0.11-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 465631e4fc6c537c5010c1deb96c35f7e2f1d4a4cfbb9fdbb09172e15585333d
MD5 611199cd16a98484aa631141ee5d36aa
BLAKE2b-256 0cd6fd0e8bcde6de8fed13bbe7ef85fff0dd2b9a85926e017a05d2b7d185887f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.11-cp39-abi3-win_amd64.whl:

Publisher: release-bindings.yml on Rxflex/rom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rom_runtime-0.0.11-cp39-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.11-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 330d968532c89272d2ca2147f744ddceb51f105e7051ef7d103a30003c535729
MD5 d5bf393cf336a6e6c0407035dab2d8a1
BLAKE2b-256 9cc98378786159990edf2b7a21e415349e6188db4517dcdcd8c7b46b60b7e697

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.11-cp39-abi3-manylinux_2_38_x86_64.whl:

Publisher: release-bindings.yml on Rxflex/rom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rom_runtime-0.0.11-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.11-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 467ab7c3a7f5dfcf0dea29b04c7938e6857b4201957730682df5d75638f313d5
MD5 4c500849ef1983951393ea63411d939a
BLAKE2b-256 13fca1032e21274d23b3c715931d19e9e724005987db1e10e8b9976df1f911eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.11-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release-bindings.yml on Rxflex/rom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rom_runtime-0.0.11-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.11-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 47058d61dc685334b3ad8b39fe170266f855e8c87d833936c63ebdf26b6b98c9
MD5 22987c65bf428aae04a973f01b7d5591
BLAKE2b-256 d120138e9ce6b6c5f97ee23a2e3eff0015bdfc65a1b46a8819d253ec352e0f0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.11-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release-bindings.yml on Rxflex/rom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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