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.10.tar.gz (746.0 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.10-cp310-abi3-manylinux_2_28_x86_64.whl (11.3 MB view details)

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

specters-4.1.10-cp310-abi3-manylinux_2_28_aarch64.whl (10.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.1.10-cp310-abi3-macosx_10_13_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: specters-4.1.10.tar.gz
  • Upload date:
  • Size: 746.0 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.10.tar.gz
Algorithm Hash digest
SHA256 9c2c9c23c256a386ca5520c5a901ca4df1285f410bd3929f8789f8cf61a5444e
MD5 bdacbfc0565ad83a4164995b1babb8b5
BLAKE2b-256 8cfa7a114ee0f7e6d9119ed1df51b0d4c2e6686e99d82d9f998e21c7002c348d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.10-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ca52ed0dc375ad3bc79390a7ae98f0c4c716d8de8e9911c630c3f3d5427441ce
MD5 327648a1f27b84d4ea2876c0bae36759
BLAKE2b-256 bdacda82d30b9edafe1f08749d762397bdd86e8491ee98926f7bdb7b583f77d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.10-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dfecf7912df4ad009e9d62478155ad49a60be9cc7c4c2dd4fb3a575f79e8ac1f
MD5 86fe7894edc4b2f5012457fa8f8020b7
BLAKE2b-256 b819cac3bd8211a04fb4922307bac92af6e5524722fea57f1fdab57eae2fc750

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.10-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18996beaa6acf5efe0fcc6ef8ec8feff3aacff42de8f606b81f7a8dfaf2fd777
MD5 b1609bf3ddb63bff187522355c5467a6
BLAKE2b-256 802ebfb9e6ec829f8d77bdb88dc357f30823057810f4137a8e6a8ebf75201935

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.10-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3fce1fbfe1dea9b9645829b22d9cfa942651da6c8a9d6c17747d17adec85e44e
MD5 f39894056c5d0dba64f51820b28486d2
BLAKE2b-256 d403dd805b8ac5b338870bc553afcbcabdadcbc01f1de429b7716eaef8b0fe2d

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