From 1a14961e4a791664652e49cbe702fcfa36e93396 Mon Sep 17 00:00:00 2001 From: Paul Schilling Date: Thu, 9 Jan 2025 16:01:55 +0100 Subject: [PATCH] [#dp-205] Increase pagination for KVK API to 100 --- src/open_inwoner/kvk/client.py | 1 + src/open_inwoner/kvk/tests/test_api.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/open_inwoner/kvk/client.py b/src/open_inwoner/kvk/client.py index 23ca0e4773..aa3c580592 100644 --- a/src/open_inwoner/kvk/client.py +++ b/src/open_inwoner/kvk/client.py @@ -85,6 +85,7 @@ def search(self, **kwargs) -> dict: Cf. https://developers.kvk.nl/nl/documentation/zoeken-api """ + kwargs.update({"resultatenPerPagina": 100}) return self._request(self.search_endpoint, params=kwargs) def get_company_headquarters(self, kvk: str, **kwargs) -> dict: diff --git a/src/open_inwoner/kvk/tests/test_api.py b/src/open_inwoner/kvk/tests/test_api.py index 0c6281e9fd..38fae5f411 100644 --- a/src/open_inwoner/kvk/tests/test_api.py +++ b/src/open_inwoner/kvk/tests/test_api.py @@ -225,7 +225,7 @@ def test_kvk_client_with_certs(self): self.kvk_client.get_company_headquarters(kvk="69599084") self.mocked_requests.assert_called_with( - f"{self.kvk_client.search_endpoint}?kvkNummer=69599084&type=hoofdvestiging", + f"{self.kvk_client.search_endpoint}?kvkNummer=69599084&type=hoofdvestiging&resultatenPerPagina=100", headers={"apikey": self.kvk_client.config.api_key}, cert=self.kvk_client.config.client_certificate.public_certificate.path, verify=self.kvk_client.config.server_certificate.public_certificate.path, @@ -243,7 +243,7 @@ def test_kvk_client_with_key_pair(self): self.kvk_client.get_company_headquarters(kvk="69599084") self.mocked_requests.assert_called_with( - f"{self.kvk_client.search_endpoint}?kvkNummer=69599084&type=hoofdvestiging", + f"{self.kvk_client.search_endpoint}?kvkNummer=69599084&type=hoofdvestiging&resultatenPerPagina=100", headers={"apikey": self.kvk_client.config.api_key}, cert=( self.kvk_client.config.client_certificate.public_certificate.path, @@ -262,7 +262,7 @@ def test_kvk_client_no_certs(self): kvk_client.search(kvkNummer="69599084") self.mocked_requests.assert_called_with( - f"{kvk_client.search_endpoint}?kvkNummer=69599084", + f"{kvk_client.search_endpoint}?kvkNummer=69599084&resultatenPerPagina=100", headers={"apikey": kvk_client.config.api_key}, verify=True, ) @@ -274,7 +274,7 @@ def test_kvk_response_not_ok(self, mocker): for code in [300, 400, 500]: with self.subTest(code=code): mocker.get( - f"{self.kvk_client.search_endpoint}?kvkNummer=69599084", + f"{self.kvk_client.search_endpoint}?kvkNummer=69599084&resultatenPerPagina=100", status_code=code, )