Skip to main content

PXM2 Playwright Helper

PyPI version License: MIT Python Version Playwright

Official Playwright automation and proxy rotation client for PXM2 dedicated 4G and 5G cellular mobile proxies.

Designed for stealth automation and high-scale web scraping. Integrate PXM2 Rotating Mobile Proxies directly into sync and async Playwright sessions with automatic authentication, mobile carrier Client Hint headers, and instant hardware IP rotation.

Read our step-by-step Playwright Proxy Automation Guides for detailed architectural blueprints.


Features

  • Sync & Async Support: Native support for both playwright.sync_api and playwright.async_api.
  • Instant Hardware IP Rotation: Trigger 1-click cellular modem reconnect webhooks directly from Python with automated reconnection cooldown.
  • Mobile Carrier Device Profiles: Automatically generate matching mobile headers (Sec-Ch-Ua, Sec-Ch-Ua-Mobile, Sec-Ch-Ua-Platform) and viewport profiles.
  • In-flight IP Verification: Inspect current external CGNAT IPs through the proxy connection.
  • Zero Heavy Dependencies: Pure Python standard library implementation.

Installation

pip install pxm2-playwright

Quickstart

1. Synchronous Playwright Example

from playwright.sync_api import sync_playwright
from pxm2_playwright import PXM2Playwright

# Initialize PXM2 client
pxm = PXM2Playwright(
    host="proxy.pxm2.io",
    port=10001,
    username="your_username",
    password="your_password",
    rotation_url="https://api.pxm2.io/rotate/YOUR_API_TOKEN",
    cooldown=6.0
)

with sync_playwright() as p:
    browser = p.chromium.launch(
        proxy=pxm.proxy_config(),
        headless=True
    )
    # Apply mobile carrier browser context options
    context = browser.new_context(**pxm.new_context_options(is_mobile=True))
    page = context.new_page()

    page.goto("https://api.ipify.org?format=json")
    print("Initial IP:", page.content())

    # Trigger instant hardware modem IP rotation
    print("Rotating 4G/5G mobile IP...")
    res = pxm.rotate()
    print("Rotation result:", res)

    page.reload()
    print("Rotated IP:", page.content())

    browser.close()

2. Asynchronous Playwright Example

import asyncio
from playwright.async_api import async_playwright
from pxm2_playwright import PXM2Playwright

pxm = PXM2Playwright(
    host="proxy.pxm2.io",
    port=10001,
    username="your_username",
    password="your_password",
    rotation_url="https://api.pxm2.io/rotate/YOUR_API_TOKEN",
    cooldown=6.0
)

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch(
            proxy=pxm.proxy_config(),
            headless=True
        )
        context = await browser.new_context(**pxm.new_context_options(is_mobile=True))
        page = await context.new_page()

        await page.goto("https://api.ipify.org?format=json")
        print("Initial IP:", await page.content())

        # Async hardware rotation
        await pxm.async_rotate()

        await page.reload()
        print("New IP:", await page.content())

        await browser.close()

asyncio.run(main())

Why PXM2 4G/5G Mobile Proxies?

Websites with advanced bot detection (Cloudflare Turnstile, DataDome, Akamai, PerimeterX) aggressively fingerprint datacenter and commercial residential subnets.

PXM2 routes traffic through dedicated cellular modems with SIM cards from tier-1 mobile carriers (AT&T, Verizon, Vodafone, Orange, EE). Mobile IPs are assigned via Carrier-Grade NAT (CGNAT), where thousands of legitimate mobile subscribers share the exact same public IPs, making blanket IP banning virtually impossible.


License

MIT License. See LICENSE for details.

Metadata

Release files for pxm2-playwright 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pxm2-playwright 1.0.0
File Size Uploaded Provenance Actions
pxm2_playwright-1.0.0.tar.gz 6.6 kB Without provenance Details for pxm2_playwright-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pxm2-playwright 1.0.0
File Interpreter ABI Platform Actions
pxm2_playwright-1.0.0-py3-none-any.whl Python 3 none any Details for pxm2_playwright-1.0.0-py3-none-any.whl

Total release size: 12.7 kB

Release files / pxm2_playwright-1.0.0.tar.gz

Download URL pxm2_playwright-1.0.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
023ce449962026e512cf89feabe39a3f540b44d794cbef49bc63ce4a30f6f3e8
BLAKE2b-256 checksum
How to use checksums
7eb89ee906b30c4b31e3874d23e474dd7fd48bd451768cbbed9a2d1d7b016c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / pxm2_playwright-1.0.0-py3-none-any.whl

Download URL pxm2_playwright-1.0.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92f3597bd6307f5a14014838da65f7dd872cfd15b3f4a93cf1fa3541911c47f2
BLAKE2b-256 checksum
How to use checksums
c5b25900db2623c5bf3a0050200ac56abe7b898fe07067a1a7d912d6ad0b06f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for pxm2-playwright 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page