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 and TPS for LLMs.

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.2.3.tar.gz (2.5 MB view details)

Uploaded Source

Built Distributions

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

specters-4.2.3-cp310-abi3-manylinux_2_28_x86_64.whl (11.9 MB view details)

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

specters-4.2.3-cp310-abi3-manylinux_2_28_aarch64.whl (11.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

specters-4.2.3-cp310-abi3-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.2.3-cp310-abi3-macosx_10_13_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.10+macOS 10.13+ x86-64

File details

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

File metadata

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

File hashes

Hashes for specters-4.2.3.tar.gz
Algorithm Hash digest
SHA256 ce0efd95567823811604089f9175262ff8804a5d11b0b6901821452c8fb9ae3d
MD5 ce6737014ca29961efd771b789290d62
BLAKE2b-256 8e4ca18f7180a5dbb1d68d4e8edcddd678c6818c16f8cc1f4b91aacf021eb157

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.3-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 86165258d6091b104570987cd34f19214757b963183fcd3983537a84fc26f71c
MD5 29ae5dd2b17d07ca90de221a8c290d1a
BLAKE2b-256 d2d951401014b91df28e107e8e32f30d9dae52a47512d32fa4752ba69e6e9fa5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.3-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 09a61ab4873df23713aef46d1f05d3fba6e45ac351f5c453efa37bb11ae82017
MD5 29a26de6877e1522f553836afa46f24b
BLAKE2b-256 97b3d4ce9e7c5728dc59ca18db20734b91ea90d73586da7f2eab628eb12b9408

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c81d38f5a8315e26bf91876935dda8524cfbbf4ce7fc6230a8091ea19f10154
MD5 dc55088dbb8525f32250c9971b5527d6
BLAKE2b-256 b88c43f5f7f4f847afdfec7eb6770caabea6419293b861964e56b4f85bf33068

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.3-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a1ef68ab76f77c735bf259a6e3b1d7629c7b542c588de1a3df9afd69e3ad7afb
MD5 b031c146a3193e05a5bc0c721c88b84a
BLAKE2b-256 68b4636b9585664ca07b9647d7b0441b618e1756020fcbf5bae7187a9a9efa9e

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