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.8.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.8-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.8-cp310-abi3-manylinux_2_28_aarch64.whl (11.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

warpsock-4.2.8-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.8.tar.gz.

File metadata

  • Download URL: warpsock-4.2.8.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.8.tar.gz
Algorithm Hash digest
SHA256 e6a073dc687ef872f095971e7a317b9fdafb856689e6b12f87e87e1b3d590fef
MD5 ccdd3a5666a7a4d7703b5da5b483f6f7
BLAKE2b-256 047c6819d18d38cf4db8811e9f66650cade6917b9f380be80aed48b701b7b273

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.8-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d9a3fd4d65f18eb4a65cf776ce828812b77feb325b21c0ad1f6fa5054b80d3ab
MD5 c20765e66556d62e2f5f13a47d5fe388
BLAKE2b-256 e680513edc8c13fe74c9fa04852d76adaf560c5ea4f0de8f8f851f4d836c2b98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.8-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9a4a5f2586ef9a8ecb05e5d880ebcec3f654ab3ccb8882307fcb573ec2c7eeba
MD5 2ff4ab6560bfaf5822e886a562c37484
BLAKE2b-256 20ec4ed236d00dd9e433fb381a53052ceb1aa89e30b44031fc4a94b97bb635f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.8-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87e0f3aaadb8e736ceb30c77e1feb7765cc4501d8cc2aae8492cbaf6381beb3f
MD5 eaa62838dae97eeb215a1a0b5fdc2bd5
BLAKE2b-256 6319ab3eb05c1320b5607eb9c94b5dad4758c2f26293817793bc53205b0923c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for warpsock-4.2.8-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f6862b9f6b22d9e6e04f706d9653435562f269e5c9abf77c27b56993e0ae6fd1
MD5 4759e743eb05fc354765438fcce827d1
BLAKE2b-256 5449a843c03b5164b20c0bc8b84c8524db670ace5230a13b798a340edc28bc7c

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