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.6.tar.gz (750.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.1.6-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.6-cp310-abi3-manylinux_2_28_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.1.6-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.6.tar.gz.

File metadata

  • Download URL: specters-4.1.6.tar.gz
  • Upload date:
  • Size: 750.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.1.6.tar.gz
Algorithm Hash digest
SHA256 9e422a5bfad76663065528ffc98fa720d979a63203e4fda8defff25edafff199
MD5 ad7bdf55ea40b36fceedb81b961dc161
BLAKE2b-256 43053b1da42933eb06b5da365a5ae13b572ea7843b692ce699b2c21b4197d912

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.6-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a1ca4ccefeaad70cd321309fc32cc1ff31588e643e7fc487e43ad4e7720c2797
MD5 6f8d21520a2114e60561c04a7097b594
BLAKE2b-256 1a7b87ac7a4287011628362100eda6b1bdbde30e5ead4bfb0aee0073cb1c3da2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.6-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 50485ba1a934e3cb89ec7b8f412cead8c600a00028c612393a556f4f1d322d87
MD5 387cc34107396b4d2e356a32ad0be01e
BLAKE2b-256 b0ec22737d5fc0171c1d49301a34da10d43325249870936b36cf0e205c10f787

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.6-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ef305394570dea3b42c045b1220ecf34b821c94a8300def517227646d5e3394
MD5 53048a37a68955b78098e0e5c707500f
BLAKE2b-256 368751d436bca7d75b2b13378157503b3a70ee587d4661c11b616f6338e7c708

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.6-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8a27ae0f67156f1f46aa6485cb1ef6519b9b853fe558efd2376c015b3ad5718c
MD5 6c1f0911eaac5423bf976cc64efbe9e0
BLAKE2b-256 a273e2e8da9ee857e82d29b130c4bf3f6b6345bc4e592c38ed4eadc8175009c9

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