[Python client] list_by_endpoint is buggy
After bumping svix Python client from 1.62 to 1.82 in [swh-webhooks](https://gitlab.softwareheritage.org/swh/devel/swh-webhooks), some of our unit tests are failing when calling the `list_by_endpoint` wrapper.
The issue can be reproduced by applying the following diff:
```diff
diff --git a/python/tests/test_client.py b/python/tests/test_client.py
index 52d54681..2139a526 100644
--- a/python/tests/test_client.py
+++ b/python/tests/test_client.py
@@ -235,3 +235,5 @@ def test_svix_message_create(
assert message_out.event_type == event_type.name
if with_channel:
assert message_out.channels == [channel]
+
+ assert svix_api.message_attempt.list_by_endpoint(svix_app_uid, endpoint_uid)
```
The modfied test then outputs the following:
```
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <svix.api.message_attempt.MessageAttempt object at 0x73b6b8d416d0>, app_id = 'e8a4225b-3568-594d-823e-db4cf110484e', endpoint_id = '7b4d441d-6b11-5cfb-acef-fc1d08583635'
options = MessageAttemptListByEndpointOptions(limit=None, iterator=None, status=None, status_code_class=None, channel=None, tag=None, before=None, after=None, with_content=None, with_msg=None, event_types=None)
def list_by_endpoint(
self,
app_id: str,
endpoint_id: str,
options: MessageAttemptListByEndpointOptions = MessageAttemptListByEndpointOptions(),
) -> ListResponseMessageAttemptOut:
"""List attempts by endpoint id
Note that by default this endpoint is limited to retrieving 90 days' worth of data
relative to now or, if an iterator is provided, 90 days before/after the time indicated
by the iterator ID. If you require data beyond those time ranges, you will need to explicitly
set the `before` or `after` parameter as appropriate.
"""
response = self._request_sync(
method="get",
path="/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}",
path_params={
"app_id": app_id,
"endpoint_id": endpoint_id,
},
query_params=options._query_params(),
header_params=options._header_params(),
)
> return ListResponseMessageAttemptOut.model_validate(response.json())
E pydantic_core._pydantic_core.ValidationError: 1 validation error for ListResponseMessageAttemptOut
E data.0.statusText
E Field required [type=missing, input_value={'url': 'http://172.17.0....12-08T13:09:44.875289Z'}, input_type=dict]
E For further information visit https://errors.pydantic.dev/2.11/v/missing
../svix/api/message_attempt.py:341: ValidationError
```
It seems the client expects a `status_text` field to be returned by the server but this is not the case (with open source version only ?).
关闭于 2025-12-11 3 条评论