Skip to main content

Python bindings for Warpsock, a Chrome-accurate HTTP client with TLS, HTTP/1.1, HTTP/2, HTTP/3, and WebSocket fingerprinting. Improved TTFT and TPS for LLMs.

Project description

Warpsock

Python bindings for the Warpsock HTTP client with TLS, HTTP/2, HTTP/3, RFC 6455 WebSocket, and RFC 8441 Extended CONNECT support.

Supported Chrome fingerprints are warpsock.FingerprintProfile.Chrome142 through warpsock.FingerprintProfile.Chrome148. Supported Firefox fingerprints are warpsock.FingerprintProfile.Firefox133 through warpsock.FingerprintProfile.Firefox151, plus ESR branches FirefoxEsr115, FirefoxEsr128, and FirefoxEsr140; examples use Chrome148, the latest implemented Chrome profile.

Installation

pip install warpsock

HTTP

Synchronous HTTP:

import warpsock

builder = warpsock.SyncClient.builder()
builder.fingerprint(warpsock.FingerprintProfile.Chrome148)
client = builder.build()

response = client.get("https://example.com/").send()
print(response.status)
print(response.text())

Async HTTP:

import warpsock

builder = warpsock.AsyncClient.builder()
builder.fingerprint(warpsock.FingerprintProfile.Chrome148)
client = builder.build()

response = await client.get("https://example.com/").send()
print(response.status)
print(response.text())

RFC 6455 WebSockets

import warpsock

builder = warpsock.Client.builder()
builder.cookie_store(True)
client = builder.build()

ws_builder = client.websocket("wss://example.com/socket")
ws_builder.subprotocol("chat.v1")
ws = await ws_builder.connect()

await ws.send_text("hello")
message = await ws.next()
await ws.close(warpsock.CloseFrame(warpsock.CLOSE_NORMAL, "done"))

RFC 8441 HTTP/2 Tunnels

import warpsock

builder = warpsock.Client.builder()
builder.http2_prior_knowledge(True)
client = builder.build()

tunnel = await client.websocket_h2("https://example.com/h2-tunnel").connect()
await tunnel.send_bytes(b"raw bytes", end_stream=False)
data = await tunnel.recv_bytes()
await tunnel.close_send()

RFC 6455 framed WebSockets and RFC 8441 raw HTTP/2 tunnels are separate APIs by design.

License

MIT

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

warpsock-4.2.7.tar.gz (2.5 MB view details)

Uploaded Source

Built Distributions

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

warpsock-4.2.7-cp310-abi3-manylinux_2_28_x86_64.whl (12.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

warpsock-4.2.7-cp310-abi3-manylinux_2_28_aarch64.whl (11.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

warpsock-4.2.7-cp310-abi3-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

warpsock-4.2.7-cp310-abi3-macosx_10_13_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

Details for the file warpsock-4.2.7.tar.gz.

File metadata

  • Download URL: warpsock-4.2.7.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for warpsock-4.2.7.tar.gz
Algorithm Hash digest
SHA256 75d86e690411f9ecc8e856d72acbb839bdf92d23075dc5b93377f101e11e8da1
MD5 1d019b035b59002ca93df90e08c0ce14
BLAKE2b-256 c385ea0f125f2a467272a43d2671249a5da7d5d3ca5d62c5d84c3ffc5bb099c2

See more details on using hashes here.

File details

Details for the file warpsock-4.2.7-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for warpsock-4.2.7-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3267dc1587fd0b72bb258ca3641c2ac0fd66fc754c817124f92aa94b0507c1c3
MD5 39c536679c592a59427689ff38200145
BLAKE2b-256 07b808baf05b8b1ef9c373036fa1bd04571c5d5630cdc93d43f7b55872b927af

See more details on using hashes here.

File details

Details for the file warpsock-4.2.7-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for warpsock-4.2.7-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6a333dea19223480730b76f2b3ed0e160db55918c4f17254fe212fab3a5e86d0
MD5 f19fc838c83144d30dab5bc44bb88e70
BLAKE2b-256 567c8834827c6aa550c4398cea97c175f561fa583894b0c67be9bb5f03532b66

See more details on using hashes here.

File details

Details for the file warpsock-4.2.7-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for warpsock-4.2.7-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac4c88810bbe69dddf17323d9b0f5bfec8a1136362868977715853a1a935234c
MD5 ce9e9e2a21175f5037acf2b89deaef89
BLAKE2b-256 553bba1a9bc25dee9bbd7851b555098c6f09c1fe4a927800ef63c114fcd89ae2

See more details on using hashes here.

File details

Details for the file warpsock-4.2.7-cp310-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for warpsock-4.2.7-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d2ba3950e385246122c1d5e0bc5daf56b71db0e3c303bf0bf6e0387eacde128f
MD5 6ff587750a1547302ba00e085c1d6424
BLAKE2b-256 f838e8cc2bacf5c54c6394f41b81f09cbfcc81785df7dd52909e63b9df54d7df

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