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

Synchronous HTTP:

import specter

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

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

Async HTTP:

import specter

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

response = await client.get("https://example.com/").send()
print(response.status)
print(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.1.9.tar.gz (744.9 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.1.9-cp310-abi3-manylinux_2_28_x86_64.whl (11.2 MB view details)

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

specters-4.1.9-cp310-abi3-manylinux_2_28_aarch64.whl (10.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

specters-4.1.9-cp310-abi3-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.1.9-cp310-abi3-macosx_10_13_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

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

File metadata

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

File hashes

Hashes for specters-4.1.9.tar.gz
Algorithm Hash digest
SHA256 0c6b98b03a795eb16cf5d6a86332c9bc99993dc6064baf455802d2eb3fa1b891
MD5 12fbc5539fca34412ffeac35bd580478
BLAKE2b-256 445cae051f0f97b5e581f8510a9f06c1f0eb4695a217941e838dd32f4feb0a1b

See more details on using hashes here.

File details

Details for the file specters-4.1.9-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for specters-4.1.9-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43fcd506a88b343819586bca77fc41a14bc02b033b89bfa352a59a345e3a69cf
MD5 b4bc782321b187e9c18d6600a304d440
BLAKE2b-256 970a8784b148a0b7f81733359ee082744cb3c13c97a17ea68e8d9876ffa761f0

See more details on using hashes here.

File details

Details for the file specters-4.1.9-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for specters-4.1.9-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 392630b109987008349f25f36cca0c35ec91cdc24bc4f2ff3b05d1e43645babd
MD5 ab733f8ce506298693def694af8fe77d
BLAKE2b-256 54a8b134e76536dfbcc239902b7f4e0c261ad7060e6ee5e2e3df39e82870cb23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.9-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99842f788c3132e3728f9bcbfa5512f856997cf667c677bdb77167370e565d65
MD5 21374865bc8b78ba53fccc3b4e210985
BLAKE2b-256 9ec77116149c558adcc28edf0ac388c9bd51f4851306f811ef33ef15f0e0bfc3

See more details on using hashes here.

File details

Details for the file specters-4.1.9-cp310-abi3-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for specters-4.1.9-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a0728ca670b37afc05ba63361fafe1b8c57f3a708b3f736bd827efa57b3559c3
MD5 2dca2e00d3461fcbbf3534ed3b9eb5b1
BLAKE2b-256 f260f739704d13e6d2951fca87b526cb8d334d967fc6a1fe0cde8fe302cff81d

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