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

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.1.4-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.4.tar.gz.

File metadata

  • Download URL: specters-4.1.4.tar.gz
  • Upload date:
  • Size: 722.1 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.4.tar.gz
Algorithm Hash digest
SHA256 8141e7ea148ab6bc32a5f9c2cde2977442d2129a4e0842d43f824876848575a0
MD5 b58a42a14f84e17b459f840c1257d764
BLAKE2b-256 7ff5b9bde41471bcb5c88cfe3f89c8acea6473f3504b702d8850f44ef6c76458

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.4-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d76421bae3492befd6892818d3181769651428e7b9928c869c33d174c54ddeb0
MD5 9e597841086972c3488159af7268a839
BLAKE2b-256 c0e7d7485c625488e37644d87dd098d9b5813ef53844239bccd2c2d40cb055d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.4-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 539a51f7a1bacfee83082ca721ea763efdb6292bd82aa57b98915dc72e03623d
MD5 e8bb3e919d3d95f822cc63d5d450f75b
BLAKE2b-256 aba10a187193bec2c968dacc0cc687391dfa4a732fdcf51335660a3ef6e3747a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5eb8d281667e5e0b05dd1a257f13fbb0a8d2bf34fab73da1ed87ee24a639113
MD5 7bcc156679dc236eeb7e277065c3d3c6
BLAKE2b-256 532c97d8b004f1ca9cce6002e08bea496219f713aa9b8b3b96dd92e745d4a48c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.1.4-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e5fc1c72179bf67015db0b812474539ef1dad57df869ae7b4964701e0f769edd
MD5 5ae19459c4b8d5348dae1153c350d24e
BLAKE2b-256 ccb2b7e3b20a5f32ff8a57ec7b831344afffa38c3f518fd9f824a598f1abd363

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