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.2.0.tar.gz (768.7 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.0-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.0-cp310-abi3-manylinux_2_28_aarch64.whl (10.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-4.2.0-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.0.tar.gz.

File metadata

  • Download URL: specters-4.2.0.tar.gz
  • Upload date:
  • Size: 768.7 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.0.tar.gz
Algorithm Hash digest
SHA256 9d9a88633bae1d1b30ebe88f1c871fed6d49759d2575f90eb602cb1d7a5e1f7a
MD5 1d5d707d7cba5724fa1cf5f70b5ed966
BLAKE2b-256 46c4a008577a2dfe6358904b9c3a5bde19ff28b8604d84780c200dcbb5acdc51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 550cd225c6c0a7f1b88bb77cfd6ded513f98a760df237477c90bf7caa33a47ee
MD5 52c7e9c797e6da4529ce90d8facde412
BLAKE2b-256 244df0b431b878bca3ae0161861918d327b28ebddfc47e81d6589c41aad54783

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 962dcdcfb4565986249c10fd971df8a185726323eb96ba91b4ca3c38d1c7ca9c
MD5 261ba536141c7c4bf20c9d35c519665e
BLAKE2b-256 c0bb7bf01dbdafb15458d9fe0aa0d21a37e3abad92b2b33645e704d63b2a7f03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a51bc19112ad5a7224f610c9a0aeb63372aefe2d4bfcac9faf47d8a602844cd
MD5 7f21ab341e0c8b762fa4ef932bdbbd5b
BLAKE2b-256 99223064e165c07fdc75ce557afcf39572c538dbd217523abee919d9ffed146d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-4.2.0-cp310-abi3-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 58db6bc6425ef35507447ea3a7b20525ec546530ec02a82261ea468f87bc9a2e
MD5 b83a08525a72e7b5d6ed480500f8e978
BLAKE2b-256 48a16ab27526ba32726ab3ccf55bf26432ae42292102dcdef26c325857f543d8

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