-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Description
When I try to pull records from the get-logs API, it fails due to a serialization error. See the code and log output.
Language
Python
Client
Search
Steps to reproduce
Here's my code. The error occurs consistently using my companies app. I can share the specific app with a member of the Algolia team.
import os
from algoliasearch.search.client import SearchClientSync
# In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods.
client = SearchClientSync(os.getenv('SEARCH_APP_ID'), os.getenv('SEARCH_API_W_KEY'))
response = client.get_logs(offset=10, length=999) # ignore the offset argument. the same error occurs without an offset and length = 200
Here's the output from pip freeze (sorry that it contains some extra packages):
aiohappyeyeballs==2.4.3
aiohttp==3.11.5
aiosignal==1.3.1
algoliasearch==4.9.1
annotated-types==0.7.0
appdirs==1.4.4
async-timeout==5.0.1
attrs==24.2.0
certifi==2024.8.30
charset-normalizer==3.4.0
frozenlist==1.5.0
idna==3.10
jedi==0.19.1
multidict==6.1.0
numpy==2.1.3
pandas==2.2.3
parso==0.8.4
prompt-toolkit==3.0.48
propcache==0.2.0
ptpython==3.0.29
pydantic==2.9.2
pydantic-core==2.23.4
pygments==2.18.0
python-dateutil==2.9.0.post0
pytz==2024.2
requests==2.32.3
six==1.16.0
typing-extensions==4.12.2
tzdata==2024.2
urllib3==2.2.3
wcwidth==0.2.13
yarl==1.17.2
Relevant log output
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
File "/home/[redacted]/.venv/lib/python3.11/site-packages/algoliasearch/search/client.py", line 7595, in get_logs
return resp.deserialize(GetLogsResponse, resp.raw_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[redacted]/.venv/lib/python3.11/site-packages/algoliasearch/http/api_response.py", line 97, in deserialize
return klass.from_json(data) # pyright: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/home/[redacted]/.venv/lib/python3.11/site-packages/algoliasearch/search/models/get_logs_response.py", line 53, in from_json
return cls.from_dict(loads(json_str))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[redacted]/.venv/lib/python3.11/site-packages/algoliasearch/search/models/get_logs_response.py", line 73, in from_dict
[Log.from_dict(_item) for _item in obj["logs"]]
File "/home/[redacted]/.venv/lib/python3.11/site-packages/algoliasearch/search/models/get_logs_response.py", line 73, in <listcomp>
[Log.from_dict(_item) for _item in obj["logs"]]
^^^^^^^^^^^^^^^^^^^^
File "/home/[redacted]/.venv/lib/python3.11/site-packages/algoliasearch/search/models/log.py", line 121, in from_dict
return cls.model_validate(obj)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[redacted]/.venv/lib/python3.11/site-packages/pydantic/main.py", line 596, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Log
nb_api_calls
Field required [type=missing, input_value={'timestamp': '2024-11-19..., 'inner_queries': None}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.9/v/missing
Self-service
- I'd be willing to fix this bug myself.