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.14.tar.gz (151.6 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.14-cp39-abi3-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

rom_runtime-0.0.14-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.14-cp39-abi3-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rom_runtime-0.0.14-cp39-abi3-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rom_runtime-0.0.14.tar.gz
  • Upload date:
  • Size: 151.6 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.14.tar.gz
Algorithm Hash digest
SHA256 660a0a60c4aa7f61a7dbbeae839dc8f3f625481c93e3920e7c1b07c2f111e932
MD5 c360d7c49ca84b513882e4f4038f00d5
BLAKE2b-256 b56cf638e0acafa4e0549b48167b72553b397a09a77b7ae7c1cb5827328a5ef8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.14.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.14-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rom_runtime-0.0.14-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.14-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e652170cf91f4b07a81e65c0fa367172dd904f528d622e2569b420bf9a5bc7f6
MD5 950809caf7146c50f703f7b3e6cc9cf0
BLAKE2b-256 c86184a0e4642e87f1740a580abb87fc1e6b4033bf8df62e8150b2cb842714c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.14-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.14-cp39-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.14-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 9f699acad0ef0baf38fd09ffae0b2d814d92a64e460f61a8330629e9bda6dccd
MD5 a47778b57e11fb44692903a2a62add64
BLAKE2b-256 3eba52c419b7020c86bfdb6d8bb1ca26141845216607c229235bd546c92bbc72

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.14-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.14-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.14-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6aadb8b677e713398007408aa8f5cc6e451b2adf7df2be3dbaf73025f9abb300
MD5 95bbd4f99dc1f8a06f6d14ee9678470e
BLAKE2b-256 a77bc3fb7c8391deb47f9d28f9f870ed2f726965e2ee34fdda12df50454f9de8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.14-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.14-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.14-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 09ec5e1ed406a7669d67dc9b9bf591dd3eacd6d97dee30244a0b5cee684a7b92
MD5 7cec81b84ec8587be6c3317936628179
BLAKE2b-256 105717d0a7534251a989c3d4241f2b2a0c5c2a118c41d68fe106e1b84e662785

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.14-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