Skip to main content

Python bindings for Specter, a Chrome-accurate HTTP client with TLS, HTTP/1.1, HTTP/2, HTTP/3, and WebSocket fingerprinting. Improved TTFT/TPS over reqwest for LLM providers.

Project description

Specter

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

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

Installation

pip install specters

HTTP

import specter

builder = specter.Client.builder()
builder.fingerprint(specter.FingerprintProfile.Chrome148)
client = builder.build()

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

RFC 6455 WebSockets

import specter

builder = specter.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(specter.CloseFrame(specter.CLOSE_NORMAL, "done"))

RFC 8441 HTTP/2 Tunnels

import specter

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

tunnel = await client.websocket_h2("https://example.com/h2-tunnel").open()
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

specters-4.0.0.tar.gz (517.3 kB view details)

Uploaded Source

Built Distributions

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

specters-4.0.0-cp310-abi3-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file specters-4.0.0.tar.gz.

File metadata

  • Download URL: specters-4.0.0.tar.gz
  • Upload date:
  • Size: 517.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for specters-4.0.0.tar.gz
Algorithm Hash digest
SHA256 64ff4689e534ef9df0920e4e852d698c50b2a3e31be706032304134e2a3cd686
MD5 04f4fec64d670e66636c257a88f7c72d
BLAKE2b-256 5406e6b94603ad53b875e3f1a213e2d751a73966e0b6d6eba8b87028b03d68b9

See more details on using hashes here.

File details

Details for the file specters-4.0.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for specters-4.0.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6430670a9d30645c64a6c154d80d484698704d2667a4704d7c774d33db0347d
MD5 b2400904ca3b7871e32671f879d76e4d
BLAKE2b-256 a652446dc6191e0b45d0bde4647e1e83d2bc0026de81ab7dc01b9c71310787e6

See more details on using hashes here.

File details

Details for the file specters-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for specters-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 11362a658bca9da3c95ad4e6d017e00aec0608155a5ae733c8d63a2bb23dea4f
MD5 353b85be5782526b2c42c73f6250ac56
BLAKE2b-256 7347a36b088501bef1e55eec7dcfee5f91afa62f5d54445af45503ebd0b08841

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