diff --git a/fedireads/books_manager.py b/fedireads/books_manager.py index c476f5796..bedcad7bd 100644 --- a/fedireads/books_manager.py +++ b/fedireads/books_manager.py @@ -19,7 +19,7 @@ def get_or_create_book(key): def search(query): - ''' ya ''' + ''' try an external datasource for books ''' connector = get_connector() return connector.search(query) diff --git a/fedireads/connectors/abstract_connector.py b/fedireads/connectors/abstract_connector.py index afa06397c..8a4dd40c0 100644 --- a/fedireads/connectors/abstract_connector.py +++ b/fedireads/connectors/abstract_connector.py @@ -10,7 +10,7 @@ class AbstractConnector(ABC): def __init__(self, identifier): # load connector settings info = models.Connector.objects.get(identifier=identifier) - self.model = info + self.connector = info self.url = info.base_url self.covers_url = info.covers_url @@ -21,8 +21,8 @@ class AbstractConnector(ABC): def is_available(self): ''' check if you're allowed to use this connector ''' - if self.model.max_query_count is not None: - if self.model.query_count >= self.model.max_query_count: + if self.connector.max_query_count is not None: + if self.connector.query_count >= self.connector.max_query_count: return False return True diff --git a/fedireads/connectors/fedireads_connector.py b/fedireads/connectors/fedireads_connector.py index dc8387542..df619c372 100644 --- a/fedireads/connectors/fedireads_connector.py +++ b/fedireads/connectors/fedireads_connector.py @@ -61,6 +61,7 @@ class Connector(AbstractConnector): book = update_from_mappings(book, data, mappings) book.source_url = response.url + book.connector = self.connector book.save() if data.get('parent_work'): diff --git a/fedireads/connectors/openlibrary.py b/fedireads/connectors/openlibrary.py index 184d59aad..ac8974e51 100644 --- a/fedireads/connectors/openlibrary.py +++ b/fedireads/connectors/openlibrary.py @@ -82,6 +82,7 @@ class Connector(AbstractConnector): book.goodreads_key = data['identifiers']['goodreads'] book.source_url = response.url + book.connector = self.connector book.save() # this book sure as heck better be an edition