Skip to content

Commit ef115e6

Browse files
committed
Add docstring back and remove extra attribute not used anymore
1 parent 5b7e1f3 commit ef115e6

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/a2a/client/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(
2929
httpx_client: httpx.AsyncClient,
3030
base_url: str,
3131
agent_card_path: str = '/.well-known/agent.json',
32-
extended_agent_card_path: str = '/agent/authenticatedExtendedCard',
3332
):
3433
"""Initializes the A2ACardResolver.
3534
@@ -40,7 +39,6 @@ def __init__(
4039
"""
4140
self.base_url = base_url.rstrip('/')
4241
self.agent_card_path = agent_card_path.lstrip('/')
43-
self.extended_agent_card_path = extended_agent_card_path.lstrip('/')
4442
self.httpx_client = httpx_client
4543

4644
async def get_agent_card(
@@ -160,7 +158,8 @@ async def get_client_from_agent_card_url(
160158
httpx_client: An async HTTP client instance (e.g., httpx.AsyncClient).
161159
base_url: The base URL of the agent's host.
162160
agent_card_path: The path to the agent card endpoint, relative to the base URL.
163-
161+
http_kwargs: Optional dictionary of keyword arguments to pass to the
162+
underlying httpx.get request when fetching the agent card.
164163
Returns:
165164
An initialized `A2AClient` instance.
166165

tests/client/test_client.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,11 @@ async def test_init_strips_slashes(self, mock_httpx_client: AsyncMock):
108108
httpx_client=mock_httpx_client,
109109
base_url='http://example.com/',
110110
agent_card_path='/.well-known/agent.json/',
111-
extended_agent_card_path='/agent/authenticatedExtendedCard/',
112111
)
113112
assert resolver.base_url == 'http://example.com'
114113
assert (
115114
resolver.agent_card_path == '.well-known/agent.json/'
116115
) # Path is only lstrip'd
117-
assert resolver.extended_agent_card_path == 'agent/authenticatedExtendedCard/'
118-
119-
resolver_no_leading_slash_path = A2ACardResolver(
120-
httpx_client=AsyncMock(),
121-
base_url='http://example.com',
122-
agent_card_path='.well-known/agent.json',
123-
)
124-
assert resolver_no_leading_slash_path.base_url == 'http://example.com'
125-
assert (
126-
resolver_no_leading_slash_path.agent_card_path
127-
== '.well-known/agent.json'
128-
)
129116

130117
@pytest.mark.asyncio
131118
async def test_get_agent_card_success_public_only(
@@ -168,17 +155,16 @@ async def test_get_agent_card_success_with_specified_path_for_extended_card(
168155
httpx_client=mock_httpx_client,
169156
base_url=self.BASE_URL,
170157
agent_card_path=self.AGENT_CARD_PATH,
171-
extended_agent_card_path=self.EXTENDED_AGENT_CARD_PATH.lstrip('/'),
172158
)
173159

174160
# Fetch the extended card by providing its relative path and example auth
175161
auth_kwargs = {"headers": {"Authorization": "Bearer testtoken"}}
176162
agent_card_result = await resolver.get_agent_card(
177-
relative_card_path=resolver.extended_agent_card_path,
163+
relative_card_path=self.EXTENDED_AGENT_CARD_PATH,
178164
http_kwargs=auth_kwargs
179165
)
180166

181-
expected_extended_url = f'{self.BASE_URL}/{resolver.extended_agent_card_path}'
167+
expected_extended_url = f'{self.BASE_URL}/{self.EXTENDED_AGENT_CARD_PATH.lstrip("/")}'
182168
mock_httpx_client.get.assert_called_once_with(expected_extended_url, **auth_kwargs)
183169
extended_card_response.raise_for_status.assert_called_once()
184170

0 commit comments

Comments
 (0)