From cf024b532a8d132f99f0c6aa2251a360ec67ff10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Fredrik=20Ki=C3=A6r?= <31612826+anders-kiaer@users.noreply.github.com> Date: Thu, 28 Sep 2023 15:22:05 +0200 Subject: [PATCH] Await response before parsing `json` data --- src/fmu/sumo/explorer/objects/_document_collection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fmu/sumo/explorer/objects/_document_collection.py b/src/fmu/sumo/explorer/objects/_document_collection.py index a1eab8df..2a9ddcd3 100644 --- a/src/fmu/sumo/explorer/objects/_document_collection.py +++ b/src/fmu/sumo/explorer/objects/_document_collection.py @@ -198,8 +198,8 @@ async def _next_batch_async(self) -> List[Dict]: if self._pit is not None: query["pit"] = self._pit.get_pit_object() - res = await self._sumo.post_async("/search", json=query).json() - hits = res["hits"] + res = await self._sumo.post_async("/search", json=query) + hits = res.json()["hits"] if self._len is None: self._len = hits["total"]["value"]