mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-01 11:52:20 +00:00
Merge pull request #3492 from bookwyrm-social/inventaire-titles
Alters get_description code for inventaire queries
This commit is contained in:
commit
03bab92ee6
2 changed files with 6 additions and 3 deletions
|
@ -222,9 +222,10 @@ class Connector(AbstractConnector):
|
|||
def get_description(self, links: JsonDict) -> str:
|
||||
"""grab an extracted excerpt from wikipedia"""
|
||||
link = links.get("enwiki")
|
||||
if not link:
|
||||
if not link or not link.get("title"):
|
||||
return ""
|
||||
url = f"{self.base_url}/api/data?action=wp-extract&lang=en&title={link}"
|
||||
title = link.get("title")
|
||||
url = f"{self.base_url}/api/data?action=wp-extract&lang=en&title={title}"
|
||||
try:
|
||||
data = get_data(url)
|
||||
except ConnectorException:
|
||||
|
|
|
@ -273,7 +273,9 @@ class Inventaire(TestCase):
|
|||
json={"extract": "hi hi"},
|
||||
)
|
||||
|
||||
extract = self.connector.get_description({"enwiki": "test_path"})
|
||||
extract = self.connector.get_description(
|
||||
{"enwiki": {"title": "test_path", "badges": "hello"}}
|
||||
)
|
||||
self.assertEqual(extract, "hi hi")
|
||||
|
||||
def test_remote_id_from_model(self):
|
||||
|
|
Loading…
Reference in a new issue