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.1.tar.gz (848.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.2.1-cp310-abi3-manylinux_2_28_x86_64.whl (11.5 MB view details)

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

specters-4.2.1-cp310-abi3-manylinux_2_28_aarch64.whl (10.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.2.1-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.2.1.tar.gz.

File metadata

  • Download URL: specters-4.2.1.tar.gz
  • Upload date:
  • Size: 848.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.2.1.tar.gz
Algorithm Hash digest
SHA256 29e7a5abd49e7b08890f43fa367edf863c9851f3a4571e505331aae376ce58d5
MD5 41ff983f4d9d46c406d17a0cfce22aa5
BLAKE2b-256 f60b735de6929a0614b8c0fef9f4c1c2fda66047f73db301e2c168f104bc9d9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d4bd0f52efbdca447c370ecaea23add11bfc5ad83cd5b2c746950a864afd0b30
MD5 bf182b115b6c53067b7d217cc0677a8f
BLAKE2b-256 46de41dd755c90bb9d772f9bc09d1c7785cf7839d5e998d22ec83bd1a1a510e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.1-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c216ecf6f2c79109573e2d7632ba58a4239018f46a641049d08e7512669f837c
MD5 3a798dbeb0d9d05ff4071696e21cdadd
BLAKE2b-256 62a736aa8c8163310fac44138996cd09ba2b5c178ed1f91d642feef02d6fa78a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4512022e2fefee1cfaa21d9b895402a862483bbe7a0fde0512e21241b083ce8
MD5 a5491ca707f445ed292ca64f5fbc13d8
BLAKE2b-256 0492d0ae5a65b72a6edff7dbcdcae9e9eadc46a3913f4ba999a396bb25440fe7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.1-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b5248f5b7c8c417d18ceb591bfe9e3aad44051d09e48f17bbd40bc2cda9bbab4
MD5 cc2d63fd83f967f05c4a4b5a54a9404e
BLAKE2b-256 30f2010d7cdc454273f61bdfb8dbe8e74fbb7484e1110ae70ab15881bca4ec92

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