Skip to content

Commit

Permalink
[#dp-205] Increase pagination for KVK API to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Schilling committed Jan 9, 2025
1 parent fbae2b8 commit 1a14961
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/open_inwoner/kvk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/open_inwoner/kvk/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
)

Expand Down

0 comments on commit 1a14961

Please sign in to comment.