Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion segmind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
InferenceTimeout,
)

__version__ = "1.0.0"
__version__ = "1.0.1"

# Default client (lazily initialized)
_default_client: Optional[SegmindClient] = None
Expand Down
7 changes: 6 additions & 1 deletion segmind/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ def _build_client(self) -> httpx.Client:
headers = {
# "Content-Type": "application/json",
"User-Agent": "segmind-python-sdk/0.1.0",
"X-Initiator": "segmind-python-sdk/0.1.0",
# SEG-319: identifies SDK traffic in spotdb. Heimdall passes
# X-Initiator through verbatim on sync (-> "SDK-PY") and suffixes
# "-V2" on the v2-async path (-> "SDK-PY-V2"). Must match the
# InitiatorType enum in spot-backend or it's coerced to OTHERS.
# Version detail stays in User-Agent above.
"X-Initiator": "SDK-PY",
}
if self.api_key:
headers["x-api-key"] = self.api_key
Expand Down
6 changes: 4 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def test_http_client_headers(self, mock_api_key):

assert http_client.headers["x-api-key"] == mock_api_key
assert http_client.headers["User-Agent"] == "segmind-python-sdk/0.1.0"
assert http_client.headers["X-Initiator"] == "segmind-python-sdk/0.1.0"
# SEG-319: stable initiator token so spotdb can attribute SDK traffic
# (heimdall suffixes -V2 on the v2-async path -> "SDK-PY-V2").
assert http_client.headers["X-Initiator"] == "SDK-PY"


def test_http_client_headers_without_api_key(self):
Expand All @@ -46,7 +48,7 @@ def test_http_client_headers_without_api_key(self):

assert "x-api-key" not in http_client.headers
assert http_client.headers["User-Agent"] == "segmind-python-sdk/0.1.0"
assert http_client.headers["X-Initiator"] == "segmind-python-sdk/0.1.0"
assert http_client.headers["X-Initiator"] == "SDK-PY"


def test_http_client_timeout_configuration(self, mock_api_key):
Expand Down
Loading