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

Uploaded CPython 3.9+Windows x86-64

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

Uploaded CPython 3.9+macOS 11.0+ ARM64

rom_runtime-0.0.13-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.13.tar.gz.

File metadata

  • Download URL: rom_runtime-0.0.13.tar.gz
  • Upload date:
  • Size: 151.5 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.13.tar.gz
Algorithm Hash digest
SHA256 1747eeb08a6bf3c1bfd3e169b3b57ced39ea2f7bca1a83e3fccd7629971eabf4
MD5 e9a7b4a9b9c0092a0d09ac659871a78a
BLAKE2b-256 b99409baf08d0a4a61ed63ad96af1745ea8ebe6bea4340f8c69c82b396e86b2e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rom_runtime-0.0.13-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.13-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 241c8513e92fad84a71f0a46bd1fbf9baba799888acc258f09ce2fb8a323a1af
MD5 bd59a056b7771d8ca224b189d0f896fe
BLAKE2b-256 6e2433194c20deaf21f8b188f2de7cf6815854e9e846085eefc1597711276d06

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rom_runtime-0.0.13-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 867ceb64eb620b974b1fd6c1dbc919db63c1fee4188212ab5a5fbb629c687110
MD5 1640fac32e97e7a7294b28240bd19c8d
BLAKE2b-256 7029f42ba9cee11afe78c22d46702fda3a9563cdc5bc363ec03e912e23d7afdc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rom_runtime-0.0.13-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6b5b1c16a86cfe848c68768ff2692284e31f5c2664da45acc46bc7538d9b863
MD5 6b61761362aafd0b6a8f8a09d5c201b4
BLAKE2b-256 0e7117ac892a16656e9b1d3395696683642eee8b36d4da3778406db30e632b5c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rom_runtime-0.0.13-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 79ae414041194eddd95b972b1090b24756de1bc3b79c75133c22dae8dc7421f9
MD5 490042a955ef2f10af0a19d606891962
BLAKE2b-256 17434f85dd5032d4a538ec9ffca037d05be70c34813f85ec149a793d00cb6a0d

See more details on using hashes here.

Provenance

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