From c41f83ec199b31c2327df6a2028e8da3ab39cccd Mon Sep 17 00:00:00 2001 From: Andreas Lien <30557582+DiFronzo@users.noreply.github.com> Date: Tue, 7 Oct 2025 09:35:49 +0200 Subject: [PATCH 1/5] Add 'lex' API endpoint to client --- snldata/client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snldata/client.py b/snldata/client.py index 21b33d7..4495ecb 100644 --- a/snldata/client.py +++ b/snldata/client.py @@ -27,6 +27,7 @@ class SnlSession: 'nkl': 'https://nkl.snl.no/api/' + api_version + '/search', # Norsk kunstnerleksikon # 'prototyping': 'https://snl.no/.api/prototyping/search', # UNSTABLE SNL - Broken 'dsd': 'https://denstoredanske.lex.dk/api/' + api_version + '/search', # Den store danske + 'lex': 'https://lex.dk/api/' + api_version + '/search', # Den store danske/Lex 'dlh': 'https://dansklitteraturshistorie.lex.dk/api/' + api_version + '/search', # Dansk litteratur historie 'dbl': 'https://biografiskleksikon.lex.dk/api/' + api_version + '/search', # Dansk biografisk leksikon 'gtl': 'https://teaterleksikon.lex.dk/api' + api_version + '/search', # Gyldendals Teaterleksikon @@ -44,6 +45,7 @@ class SnlSession: SHORT_TO_LONG = { 'dsd': 'denstoredanske', + 'lex': 'lex', 'dlh': 'dansklitteraturshistorie', 'dbl': 'biografiskleksikon', 'gtl': 'teaterleksikon', From 11242d22b29fea41bbaad6a3e8a3b56911175a0e Mon Sep 17 00:00:00 2001 From: Andreas Lien <30557582+DiFronzo@users.noreply.github.com> Date: Tue, 7 Oct 2025 09:39:12 +0200 Subject: [PATCH 2/5] Change search zone from 'dsd' to 'lex' in README Updated the zone parameter from 'dsd' to 'lex' in search examples. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9d56ace..aff18d7 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Outputs: the JSON object ### LEX | code | Website | Note | --- | --- | --- | -| `dsd` | https://denstoredanske.lex.dk/ | +| `lex` | https://lex.dk/ | is Den Store Danske/Danmarks Nationalleksikon | `dlh` | https://dansklitteraturshistorie.lex.dk/ | | `dbl` | https://biografiskleksikon.lex.dk/ | | `gtl` | https://teaterleksikon.lex.dk/ | @@ -125,7 +125,7 @@ Outputs: `Spellemannprisen` import snldata R = snldata.SnlSession() -R.search(zone='dsd', query="Python", best=True) #Pick the one with the best rank +R.search(zone='lex', query="Python", best=True) #Pick the one with the best rank print(R.url) ``` Outputs: `https://denstoredanske.lex.dk/Python` @@ -141,7 +141,7 @@ If the API returns no results, `.json` will be given a empty list. import snldata R = snldata.SnlSession() -R.search(zone='dsd', query="asdadasdasdad", best=True) #Pick the one with the best rank +R.search(zone='lex', query="asdadasdasdad", best=True) #Pick the one with the best rank print(R.json) ``` Outputs: `{}` @@ -150,7 +150,7 @@ Outputs: `{}` import snldata R = snldata.SnlSession() -R.search(zone='dsd', query="jdfhdskjfhsjkdfhksdfh") #Pick the three best results, but there are none +R.search(zone='lex', query="jdfhdskjfhsjkdfhksdfh") #Pick the three best results, but there are none R._get(0) print(R.json) ``` From 690931c436aa62ffc8150f5b8c107d5b71007bd8 Mon Sep 17 00:00:00 2001 From: Andreas Lien <30557582+DiFronzo@users.noreply.github.com> Date: Tue, 7 Oct 2025 09:39:42 +0200 Subject: [PATCH 3/5] Bump version from 1.1.3 to 1.1.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e852c3a..c05b6e2 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def get_long_description() -> str: setuptools.setup( name="SnlData", - version="1.1.3", + version="1.1.4", description="A lightweight Python library for Store Norske Leksikon and Lex.dk/Den Store Danske APIs.", long_description=get_long_description(), long_description_content_type="text/markdown", From d0a18a894a4d9677fbb70fe223029b26bbe31877 Mon Sep 17 00:00:00 2001 From: Andreas Lien <30557582+DiFronzo@users.noreply.github.com> Date: Tue, 7 Oct 2025 09:43:23 +0200 Subject: [PATCH 4/5] Rename tests for lex instead of dsd --- tests/test_client.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 18fcb55..3d03ac4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -24,17 +24,17 @@ def test_simplereq(self): self.test = self.G.get("https://snl.no/api/v1/search?query=") self.assertEqual(self.test.status_code, 200) - def test_simplereq_dsd(self): + def test_simplereq_lex(self): self.G = requests.Session() - self.test = self.G.get("https://denstoredanske.lex.dk/api/v1/search?query=") + self.test = self.G.get("https://lex.dk/api/v1/search?query=") self.assertEqual(self.test.status_code, 200) def test_query(self): self.service.search(query="TCP", best=True) self.assertEqual(self.service.title, "TCP") - def test_query_dsd(self): - self.service.search(zone='dsd', query="februar", best=True) + def test_query_lex(self): + self.service.search(zone='lex', query="februar", best=True) self.assertEqual(self.service.title, "februar") def test_query_lille(self): @@ -45,8 +45,8 @@ def test_query_zero_result(self): self.service.search(query="asdasdadadsasdasdasd", best=True) self.assertEqual(self.service.json, {}) - def test_query_zero_result_dsd(self): - self.service.search(zone='dsd', query="asdasdadadsasdasdasd", best=True) + def test_query_zero_result_lex(self): + self.service.search(zone='lex', query="asdasdadadsasdasdasd", best=True) self.assertEqual(self.service.json, {}) # API endpoint removed @@ -57,9 +57,9 @@ def test_query_zero_result_dsd(self): # self.assertEqual(self.service.title, "TCP") # API endpoint removed - # def test_query2_dsd(self): + # def test_query2_lex(self): # self.service.searchV2( - # {"encyclopedia": "dsd", "query": "februar", "limit": 3, "offset": 0}, + # {"encyclopedia": "lex", "query": "februar", "limit": 3, "offset": 0}, # zone="prototyping", best=True) # self.assertEqual(self.service.title, "februar") @@ -97,9 +97,9 @@ def test_search_fail(self): self.assertTrue("Something went wrong with the parameters!" in str(context.exception)) - def test_search_fail_dsd(self): + def test_search_fail_lex(self): with self.assertRaises(Exception) as context: - self.service.search(zone='dsd2', query="NTNU", limit=11) + self.service.search(zone='lex2', query="NTNU", limit=11) self.assertTrue("Something went wrong with the parameters!" in str(context.exception)) From e71fef9aa79815e9d71102456dae6c5954536e43 Mon Sep 17 00:00:00 2001 From: Andreas Lien <30557582+DiFronzo@users.noreply.github.com> Date: Tue, 7 Oct 2025 09:46:18 +0200 Subject: [PATCH 5/5] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aff18d7..477bc97 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ R = snldata.SnlSession() R.search(zone='lex', query="Python", best=True) #Pick the one with the best rank print(R.url) ``` -Outputs: `https://denstoredanske.lex.dk/Python` +Outputs: `https://lex.dk/Python` ### Advance Query (best for prototyping api) - Main documentation (SNL): [API-dokumentasjon - prototyping](https://meta.snl.no/API-dokumentasjon_-_prototyping)