Skip to main content

Python bindings for Specter HTTP, WebSocket, HTTP/2, and HTTP/3 tunnel client

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; examples use Chrome148, the latest implemented 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-3.2.0.tar.gz (471.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-3.2.0-cp310-abi3-macosx_11_0_arm64.whl (3.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

specters-3.2.0-cp310-abi3-macosx_10_12_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for specters-3.2.0.tar.gz
Algorithm Hash digest
SHA256 daad435bbc724941935a0681088ac8f38b5ae4dc7733399079be6b306f47df93
MD5 ea0fc79246223cbc63efc11bb56fea48
BLAKE2b-256 d417fcdc641d33f2a91ce118691db0c536156d778146308a6ad1c4298b7ef50b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for specters-3.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c749fb32e6119d9b3b6ada945230857a40bb075053731e1b4586985dc17c6d9a
MD5 24306b1269e82ec6cda29fdfbf3a8e1c
BLAKE2b-256 2bbae7f357a372b9d6d65bf3885d9118b4ad55f9dd13b8413fec538b1b846840

See more details on using hashes here.

File details

Details for the file specters-3.2.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for specters-3.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c3868d72c021d9a5c453b59bdccaf9ab7c36ef4972bcd0c5d274dc87c6fdf0e5
MD5 2e6de684a069d69595c398d3be1aa1f6
BLAKE2b-256 4358ca748a7498e087155a321a08a3b14f706e86ca2004e8f2bd0d81c21b5c06

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