Privacy-safe client signals for CLI HTTP traffic.
Actively maintained. Last release 5 weeks ago, commits in 7 of the last 26 weeks. A safe choice.
pip install client-signalsclient-signals for Python
Python implementation of the shared client-signals contract.
Installation
pip install client-signals
Import as client_signals.
Requires Python 3.9 or newer.
Usage
import client_signals
signals = client_signals.detect_once()
headers = {}
client_signals.apply_headers(headers, signals)
headers["User-Agent"] = f"my-cli/1.0 {client_signals.user_agent_suffix(signals)}"
Use a custom header prefix:
client_signals.apply_headers(headers, signals, prefix="Acme")
API
detect()computes fresh signals.detect_once()computes and caches process-wide signals.headers_for(signals, prefix="Fly")returns a header dictionary.apply_headers(target, signals, prefix="Fly")updates a mutable header mapping.user_agent_suffix(signals)returns the client-signals User-Agent token.operator(signals)returnsci,agent,interactive, orunknown; precedence is in that order.Signalsis the dataclass returned by detection.sanitize_invoked_by(value)andclassify_parent_name(raw)are exposed for tests and advanced consumers that need the shared contract helpers.
Development
python3 -m unittest