diff --git a/README.md b/README.md index 9d56ace..477bc97 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,10 +125,10 @@ 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` +Outputs: `https://lex.dk/Python` ### Advance Query (best for prototyping api) - Main documentation (SNL): [API-dokumentasjon - prototyping](https://meta.snl.no/API-dokumentasjon_-_prototyping) @@ -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) ``` 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", 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', 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))