Skip to content

Client Configuration

Constructor

from tango import TangoClient

client = TangoClient(
    api_key="your-api-key",           # or set TANGO_API_KEY env var
    base_url="https://tango.makegov.com",  # default
    user_agent="my-app/1.0",          # optional custom User-Agent
    extra_headers={"X-Custom": "val"},  # optional additional headers
)
Parameter Type Default Description
api_key str \| None None API key. Falls back to TANGO_API_KEY environment variable.
base_url str "https://tango.makegov.com" Base URL for the Tango API.
user_agent str \| None None Custom User-Agent string appended to the default.
extra_headers dict[str, str] \| None None Additional HTTP headers sent with every request.

The client uses httpx under the hood with a 30-second timeout.

Properties

rate_limit_info

Returns rate limit information from the most recent API response.

resp = client.list_contracts(limit=5)
info = client.rate_limit_info

if info:
    print(f"Remaining: {info.remaining}/{info.limit}")
    print(f"Resets in: {info.reset}s")
    print(f"Daily remaining: {info.daily_remaining}/{info.daily_limit}")

The RateLimitInfo object exposes:

Field Type Description
limit int \| None Request limit for the current window
remaining int \| None Requests remaining in the current window
reset int \| None Seconds until the window resets
daily_limit int \| None Daily request limit
daily_remaining int \| None Daily requests remaining
daily_reset int \| None Seconds until the daily limit resets
burst_limit int \| None Burst request limit
burst_remaining int \| None Burst requests remaining
burst_reset int \| None Seconds until the burst limit resets

last_response_headers

Returns the full HTTP headers from the most recent API response, as an httpx.Headers object.

resp = client.list_contracts(limit=5)
headers = client.last_response_headers
print(headers["content-type"])