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.1.5.tar.gz (722.1 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.5-cp310-abi3-manylinux_2_28_x86_64.whl (4.3 MB view details)

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

specters-4.1.5-cp310-abi3-manylinux_2_28_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

specters-4.1.5-cp310-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.1.5-cp310-abi3-macosx_10_13_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: specters-4.1.5.tar.gz
  • Upload date:
  • Size: 722.1 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.5.tar.gz
Algorithm Hash digest
SHA256 b675f0ae4f90342f06cc7cbd21a5a29933dd9075da9a178d5d7fbf4d9e30dd63
MD5 ffb41a93221d9c71c440cd8ba2068480
BLAKE2b-256 7833af6b14e1264134e28831412305b99acd1b08172140d16a915509894df661

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.5-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2806a1b879cb0695e8bfa9838c825f847490379da153be90fd15154090cb0043
MD5 0180b0f93eeb04fe58065821885c8327
BLAKE2b-256 ce805fcc9a44e61652ed1aa2b5f72024ba10e8a23b674c0078b9bd7be3676223

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.5-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d5346a73e253e196e4e34ab4ffb0efed8347ec57e5ef74d1d7e67991421f0f0d
MD5 a35ec4cb58af3d54c02b7a9a401ffc24
BLAKE2b-256 d2cbe5dd12dcd54da963dfbb200da1467da1dc5bc6b4db25962b2f7c148051ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56d546d202e33e7c712655f7f5c156e34fc68773f210fca447ecd9f75d72b499
MD5 495e296be74523a38143243625c80ee8
BLAKE2b-256 a51d0fdd4682e56ba6d44360bf984473198a37129ebe2cee2fbbf66939f24c36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.5-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f2bc76773f2c35802ff0be6f08d955a19d42888c97f0d2fc91a92e62d59a525b
MD5 34902c09192f4283a9e4b48c8b2f1997
BLAKE2b-256 063e4f42ab5ab39e89ba35db6c726751762fcd2436b26316dcadff54044ba9eb

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