Skip to content

Commit

Permalink
enable finna connector
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkka-ollakka committed Jan 29, 2025
1 parent e32161a commit bc4a0a2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bookwyrm/connectors/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" settings book data connectors """

CONNECTORS = ["openlibrary", "inventaire", "bookwyrm_connector"]
CONNECTORS = ["openlibrary", "inventaire", "bookwyrm_connector", "finna"]
19 changes: 19 additions & 0 deletions bookwyrm/management/commands/initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ def init_connectors():
priority=1,
)

models.Connector.objects.create(
identifier="api.finna.fi",
name="Finna API",
connector_file="finna",
base_url="https://www.finna.fi",
books_url="https://api.finna.fi/api/v1/record"
"?id=",
covers_url="https://api.finna.fi",
search_url="https://api.finna.fi/api/v1/search?limit=20"
"&filter[]=format%3a%220%2fBook%2f%22"
"&field[]=title&field[]=recordPage&field[]=authors&field[]=year&field[]=id&field[]=formats"
"&lookfor=",
isbn_search_url="https://api.finna.fi/api/v1/search?limit=1"
"&filter[]=format%3a%220%2fBook%2f%22"
"&field[]=title&field[]=recordPage&field[]=authors&field[]=year&field[]=id&field[]=formats"
"&lookfor=isbn:",
priority=1,
)


def init_settings():
"""info about the instance"""
Expand Down
2 changes: 1 addition & 1 deletion bookwyrm/tests/management/test_initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_command_no_args(self):
# everything should have been called
self.assertEqual(Group.objects.count(), 4)
self.assertTrue(Permission.objects.exists())
self.assertEqual(models.Connector.objects.count(), 3)
self.assertEqual(models.Connector.objects.count(), 4)
self.assertEqual(models.SiteSettings.objects.count(), 1)
self.assertEqual(models.LinkDomain.objects.count(), 5)

Expand Down

0 comments on commit bc4a0a2

Please sign in to comment.