Skip to main content

Playwright storage_state zip export — backup sessions, diff bundles, MLX cookie pull/push. CLI: session-bundle.

Project description

session-bundle-kit

Playwright session export & backup — zip storage_state cookies and localStorage; MLX cookie pull/push for profile migration.

PyPI version Python versions License: MIT

pip install session-bundle-kit
session-bundle export state.json -o bundle.zip

CLI: session-bundle · Python 3.10+ · optional [mlx] for Launcher helpers

Partner (optional): Restore sessions into isolated MLX profiles — not a shared Chrome user-data-dir. Multilogin X · SAAS50 / MIN50 on eligible new purchases. Export/diff works offline without MLX. Affiliate disclosure · Multilogin promo codes.

Playwright session export & backup — zip storage_state cookies and localStorage; MLX cookie pull/push for profile migration.

Export and compare browser session bundles — cookies, localStorage, sessionStorage, and IndexedDB metadata — from Playwright storage state JSON.

Pure Python zip format. Optional MLX push for cookie import into antidetect profiles.

Problem

Playwright storage_state.json is a single file mixing cookies and per-origin storage. Teams need:

  • Portable zip bundles with a manifest for CI and backups
  • Dry-run validation before restoring sessions
  • Diff between two session snapshots
  • Push cookies into MLX profiles after export

Install

pip install session-bundle-kit

MLX profile push:

pip install session-bundle-kit[mlx]

Quick start

# Export Playwright storage state -> bundle zip
session-bundle export --playwright-context ./state.json -o bundle.zip

# Validate bundle (dry-run default)
session-bundle import bundle.zip --dry-run

# Compare two bundles
session-bundle diff bundle_a.zip bundle_b.zip

Bundle format (spec v1)

bundle.zip
├── manifest.json          # spec, version, counts, source
├── cookies.json           # Playwright cookie list
├── origins/
│   └── https%3A%2F%2Fexample.com.json   # localStorage + sessionStorage
└── indexeddb/
    └── metadata.json      # IDB database names/versions (metadata only)

IndexedDB metadata is included for audit/diff; full IDB binary export is out of scope.

manifest.json example:

{
  "spec": "session-bundle-v1",
  "version": 1,
  "source": "playwright-storage-state",
  "cookie_count": 12,
  "origin_count": 3,
  "indexeddb_count": 0
}

CLI

Command Description
session-bundle export --playwright-context FILE -o OUT.zip Create bundle from Playwright state
session-bundle import FILE --dry-run Validate bundle without writing (default)
session-bundle diff A.zip B.zip Cookie domain + storage/IDB diff
session-bundle mlx-pull --profile-id UUID -o bundle.zip Export MLX profile cookies → bundle ([mlx])
session-bundle mlx-push --profile-id UUID --bundle FILE Import bundle cookies to MLX ([mlx])
session-bundle mlx-push ... --dry-run Validate bundle; no MLX API calls

API

from session_bundle_kit import export_playwright_context, validate_bundle, diff_bundles

export_playwright_context("state.json", "bundle.zip")
report = validate_bundle("bundle.zip")
diff = diff_bundles("old.zip", "new.zip")

Restore to Playwright:

from session_bundle_kit.bundle import SessionBundle

bundle = SessionBundle.read_zip("bundle.zip")
context = await browser.new_context(storage_state=bundle.to_playwright_storage_state())

MLX pull / push ([mlx] extra)

Round-trip cookies between MLX profiles and neutral session-bundle-v1 zips. Storage/IDB in bundles from Playwright export are manifest-only on push; MLX Launcher APIs move cookies only.

Pull (profile → zip):

  1. GET api.multilogin.com/profile/unlock?profile_ids=UUID
  2. POST launcher.mlx.yt:45001/api/v1/cookies/export

Push (zip → profile):

  1. Validate bundle (--dry-run stops here)
  2. GET api.multilogin.com/profile/unlock?profile_ids=UUID
  3. POST launcher.mlx.yt:45001/api/v1/cookies/import
export MLX_TOKEN="..."

# Export MLX profile session to portable bundle
session-bundle mlx-pull --profile-id PROFILE_UUID -o bundle.zip

# Validate before import
session-bundle mlx-push --profile-id PROFILE_UUID --bundle bundle.zip --dry-run

# Import cookies into target profile
session-bundle mlx-push --profile-id PROFILE_UUID --bundle bundle.zip

Peer pattern for Launcher lifecycle: see cdp-connect-kit MLX integration docs.

When login sessions break after profile switch (playbook)

Sites re-challenge when cookies land on a new fingerprint or IP. Use bundles to move stored credentials deliberately — not as a bypass.

Symptom Likely cause Next step
Import ok, still logged out Domain/subdomain mismatch, expired cookies session-bundle diff old vs new; fix with cookie-jar-bridge
Step-up / CAPTCHA after restore IP or fingerprint drift Match proxy lane; probe with playwright-cdp-probe
MLX push succeeds, site fails Cookies only — no localStorage on target Restore storage via Playwright storage_state on same profile
Migration metadata only antidetect-importer left _cookies sidecar mlx-pull source → edit → mlx-push --dry-run → push

Session migration pipeline:

session-bundle export --playwright-context state.json -o bundle.zip
session-bundle import bundle.zip --dry-run
session-bundle mlx-push --profile-id TARGET_UUID --bundle bundle.zip --dry-run
export MLX_TOKEN=...
session-bundle mlx-push --profile-id TARGET_UUID --bundle bundle.zip
cdp-probe mlx --profile-id TARGET_UUID --url https://your-app.example  # verify session + exposure

Coupon hub: Multilogin promo codes — guides for SAAS50 / MIN50, pricing comparisons, and workflow playbooks. Migration partner note: Multi-account moves use mlx-pull / mlx-push on Multilogin X Launcher. Code SAAS50 (browser) — verify eligibility before checkout. Full coupons: session-bundle --show-deal.

Treat bundle zips as secrets — same sensitivity as password files.

When Chrome user-data-dir fails in 2026

Starting with Chrome 136 (March 2025), Google changed how remote debugging works on the default profile. Per the Chrome Developers blog:

  • --remote-debugging-port and --remote-debugging-pipe are ignored when targeting Chrome's default user data directory.
  • You must pass a custom --user-data-dir pointing to a non-default profile path for CDP to bind.
  • The change targets cookie theft via remote debugging after App-Bound Encryption; Chrome for Testing still supports the older automation workflow.

Practical impact: copying your daily Default profile and launching with --remote-debugging-port no longer works on stock Chrome 136+. Session-bundle-kit sidesteps this by exporting Playwright storage_state.json (cookies + origin storage) into portable zips — restore via new_context(storage_state=...) on antidetect or isolated profiles instead of attaching CDP to your real Chrome profile.

Enterprise admins can still control remote debugging via the Allow remote debugging Chrome policy on managed devices.

Limitations

  • No live IDB export — IndexedDB section is metadata manifest only.
  • sessionStorage preserved in bundle format but Playwright native export may omit it; include in custom state JSON if needed.
  • mlx-push imports cookies only; storage must be restored via Playwright or profile sync separately.
  • Secrets — bundles contain session secrets; treat zip files as credentials. Import warns on likely plaintext passwords in web storage.

Production

Export sessions to portable zips, validate with mlx-push --dry-run, then import cookies into MLX profiles after antidetect-importer migration or failed login on a new profile.

Partner note (affiliate): When restoring sessions into isolated Multilogin X profiles (not shared Chrome user-data-dir), Launcher cookie import pairs with profile-level proxy and fingerprint. Eligible new browser purchases may accept code SAAS50 at multilogin.com — verify terms before checkout. Export/diff/validate work without MLX. Full disclosure: docs/AFFILIATE.md. Deals hub: anti-detect.github.io. Coupon details only via session-bundle --show-deal (never printed by default).

FAQ: docs/FAQ.md — Playwright storage_state export, Chrome 136 CDP, MLX cookie import.

Related tools (on PyPI)

Package CLI Role
playwright-cdp-probe cdp-probe CDP / WebDriver exposure score
cookie-jar-bridge cookie-bridge Netscape ↔ Playwright cookies
proxy-lane-checker proxy-lane Proxy TCP / HTTP / geo / DNSBL
fingerprint-coherence fp-coherence UA / screen / timezone lint

Toolkit pipeline: proxy-lane checkfp-coherence audit → automate → cdp-probe runcookie-bridge validate

License

MIT


Production antidetect (partner): Multilogin X · Code SAAS50 (-50% browser) · MIN50 (-50% cloud phone)
Affiliate disclosure — we may earn a commission; offers change on the vendor site. More scripts: @Multilogin_Scripts_Bot · Multilogin promo codes

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

session_bundle_kit-0.3.4.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

session_bundle_kit-0.3.4-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file session_bundle_kit-0.3.4.tar.gz.

File metadata

  • Download URL: session_bundle_kit-0.3.4.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for session_bundle_kit-0.3.4.tar.gz
Algorithm Hash digest
SHA256 2302933415817dd5444568acaab20d4c21ebfb7ad031da913bbba070fda9396a
MD5 4b1f21d5ba72bbbfb1a1ea4c0e2fd9b9
BLAKE2b-256 be5b377e5a4ec1d4d96a6e25b57eb92e41fadaab08fc087a5c2c73d53a6d8354

See more details on using hashes here.

File details

Details for the file session_bundle_kit-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for session_bundle_kit-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9d9c8972973e1ee15c6e7eb98f8e8397f6a4d931f68c619ba8f0ba003bdbf5e2
MD5 29d0bf61b93ce061bb58823c8fd7c62d
BLAKE2b-256 32f8763c29307bac5bab1c0559508a278c67cc95693405813ddc78d63e15e8ea

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