Skip to content

Support custom headers and user_agent in TangoClient constructor #16

@vdavez

Description

@vdavez

Problem

TangoClient doesn't accept custom headers or a user_agent parameter. Callers that need to identify themselves (e.g. tango-mcp setting User-Agent: tango-mcp/0.7.2) have to reach into the internal httpx.Client and mutate headers after construction:

real_client = TangoClient(api_key=key, base_url=base_url)
real_client.client.headers["User-Agent"] = "tango-mcp/0.7.2"

This works but couples callers to the httpx implementation detail.

Proposal

Add optional parameters to TangoClient.__init__:

def __init__(
    self,
    api_key: str | None = None,
    base_url: str = "https://tango.makegov.com",
    user_agent: str | None = None,
    headers: dict[str, str] | None = None,
):
  • user_agent sets the User-Agent header (appended to or replacing the default)
  • headers merges additional headers into every request (e.g. for tracing, source identification)

This would let tango-mcp do:

TangoClient(api_key=key, user_agent="tango-mcp/0.7.2")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions