Fixes API search causing 500 error

This commit is contained in:
Mouse Reeve
2020-12-30 11:37:26 -08:00
parent 8ffb22291a
commit e5a914c3c2
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
''' functionality outline for a book data connector '''
from abc import ABC, abstractmethod
from dataclasses import dataclass
from dataclasses import asdict, dataclass
import logging
from urllib3.exceptions import RequestError
@ -241,6 +241,12 @@ class SearchResult:
return "<SearchResult key={!r} title={!r} author={!r}>".format(
self.key, self.title, self.author)
def json(self):
''' serialize a connector for json response '''
serialized = asdict(self)
del serialized['connector']
return serialized
class Mapping:
''' associate a local database field with a field in an external dataset '''