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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file specters-4.1.8.tar.gz.
File metadata
- Download URL: specters-4.1.8.tar.gz
- Upload date:
- Size: 743.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4877a89e5521084b0b71cce28e8441eb67625696d89d6dd7d4577770b1411ae
|
|
| MD5 |
b5e3aaa2876a2bcaef7445de74293df0
|
|
| BLAKE2b-256 |
329d82e554f42ad8874f60ccf8b0b04c0ef0cee93a3f2a4672106ff12b8c1733
|
File details
Details for the file specters-4.1.8-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: specters-4.1.8-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.2 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e9d85f2448934a44dc0b45f008fc7bec2c37146dd20c012a44f84e24a3eda35
|
|
| MD5 |
7fd41ee70218c885667ab7fe55870e7f
|
|
| BLAKE2b-256 |
f5300454c1bfe5483ec10a17f08df9c5f596bb7d3eca55554e2151b61b3ec8fb
|
File details
Details for the file specters-4.1.8-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: specters-4.1.8-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 10.4 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9735e98afb65bbe524faa64c6f1e1597cf3bda7301a8da34d360d6dcead124cd
|
|
| MD5 |
77fd071cf6040d23996cb5bfc0606192
|
|
| BLAKE2b-256 |
ae64fa5daf9d46f5cdd65748043d7dae2eea802410b6490b2097117a06a9ca72
|
File details
Details for the file specters-4.1.8-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: specters-4.1.8-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d88d6ddc549571ad348766dd639da4f3785e2e1820ee2fa4c3852beb36d98d1
|
|
| MD5 |
ca647b6e3747fe966b368e272000a3df
|
|
| BLAKE2b-256 |
3e93f141666fb240c89fe95680888bcea2fc1784d7948edd3c2c58c30f2449e1
|
File details
Details for the file specters-4.1.8-cp310-abi3-macosx_10_13_x86_64.whl.
File metadata
- Download URL: specters-4.1.8-cp310-abi3-macosx_10_13_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10+, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
451872b9c17024ef8a03dbdee217e14b9b998bace64dd49bee6e87a6d86c7af7
|
|
| MD5 |
2f177b762bee659fff22f459ddee07d5
|
|
| BLAKE2b-256 |
ad21396fc951c1f66dba279521f7e8c249b45cccb34ccd3b4c93e7c7b85a9138
|