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.5.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.5-cp310-abi3-manylinux_2_28_x86_64.whl (11.9 MB view details)

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

warpsock-4.2.5-cp310-abi3-manylinux_2_28_aarch64.whl (11.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

warpsock-4.2.5-cp310-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

warpsock-4.2.5-cp310-abi3-macosx_10_13_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: warpsock-4.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 6e6f8478b0c3613e7dfad42f70e2937f1e204acc13abb25215ba1e69050205fe
MD5 2cfa57f2791668ce89f7feeae9d3835d
BLAKE2b-256 d191411faf69b0ebc40b4140079ada5a2f7f1f3e92960995b8f32ab56bcbc6b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.5-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 323e31caca6dcd496951758d9c3da427f540da6a6416548afc052b51d4b5e760
MD5 e41bb021b34213a0eb827f6a80642fb1
BLAKE2b-256 f61e69d3efa743b1e38652927578d0548bd81e34a6417277e416aa1067664d54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.5-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 001d5055ad5c15218579e7d1d1d783cf2e24677b8fd6326688778fd77895f280
MD5 904d19aa50f60e4aef56b98dce411fa9
BLAKE2b-256 58dc39dc964a3ba94dbd9a569a3f29bc486e478e30b9ad2d921212ad37623f69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 039eeb4547ae7466b536bb41258ca3ca0ca30fa08c5198581db93fe258a54535
MD5 37cac8dd98f58fb2a7b0fc12e86f531b
BLAKE2b-256 7e14736dc3b966bdaf67700a40f22346f3e946a723231518d25c39b3cf57f12c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.5-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6de74709c9068987efdebf436ccc60ecfbc4c7c87dce173cf9691b27149eab2f
MD5 39a7de5feb52b2dc0939c7ebd0717ddb
BLAKE2b-256 755953ade0d5bd0ed371efab173080200ac0fa0e6704c0da70afab0a43031dbf

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