Skip to content

Commit 19c8a07

Browse files
vdavezclaude
andcommitted
v0.4.4: add parent_piid filter, custom headers, and last_response_headers
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent edd4158 commit 19c8a07

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.4.4] - 2026-03-25
11+
12+
### Added
13+
- `parent_piid` filter parameter on `list_contracts` for filtering orders under a specific parent IDV PIID.
14+
- `user_agent` and `extra_headers` parameters on `TangoClient` for custom request headers.
15+
- `TangoClient.last_response_headers` property for accessing full HTTP headers from the most recent API response.
16+
1017
## [0.4.3] - 2026-03-21
1118

1219
### Added

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "tango-python"
7-
version = "0.4.3"
7+
version = "0.4.4"
88
description = "Python SDK for the Tango API"
99
readme = "README.md"
1010
requires-python = ">=3.12"

tango/client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def __init__(
5959
self,
6060
api_key: str | None = None,
6161
base_url: str = "https://tango.makegov.com",
62+
user_agent: str | None = None,
63+
extra_headers: dict[str, str] | None = None,
6264
):
6365
"""
6466
Initialize the Tango API client
@@ -67,6 +69,8 @@ def __init__(
6769
api_key: API key for authentication. If not provided, will attempt to load from
6870
TANGO_API_KEY environment variable.
6971
base_url: Base URL for the API
72+
user_agent: Custom User-Agent header value.
73+
extra_headers: Additional headers to include in every request.
7074
"""
7175
# Load API key from environment if not provided
7276
self.api_key = api_key or os.getenv("TANGO_API_KEY")
@@ -76,9 +80,14 @@ def __init__(
7680
headers = {}
7781
if self.api_key:
7882
headers["X-API-KEY"] = self.api_key
83+
if user_agent:
84+
headers["User-Agent"] = user_agent
85+
if extra_headers:
86+
headers.update(extra_headers)
7987

8088
self.client = httpx.Client(headers=headers, timeout=30.0)
8189
self._last_rate_limit_info: RateLimitInfo | None = None
90+
self._last_response_headers: httpx.Headers | None = None
8291

8392
# Use hardcoded sensible defaults
8493
cache_size = 100
@@ -105,6 +114,11 @@ def rate_limit_info(self) -> RateLimitInfo | None:
105114
"""Rate limit info from the most recent API response."""
106115
return self._last_rate_limit_info
107116

117+
@property
118+
def last_response_headers(self) -> httpx.Headers | None:
119+
"""Full HTTP headers from the most recent API response."""
120+
return self._last_response_headers
121+
108122
@staticmethod
109123
def _parse_rate_limit_headers(headers: httpx.Headers) -> RateLimitInfo:
110124
"""Extract rate limit info from response headers."""
@@ -140,6 +154,7 @@ def _request(
140154

141155
try:
142156
response = self.client.request(method=method, url=url, params=params, json=json_data)
157+
self._last_response_headers = response.headers
143158
self._last_rate_limit_info = self._parse_rate_limit_headers(response.headers)
144159

145160
if response.status_code == 401:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)