parent
da69b82d8a
commit
9aada80c05
9 changed files with 61 additions and 43 deletions
|
@ -1,5 +1,7 @@
|
|||
''' functionality outline for a book data connector '''
|
||||
from abc import ABC, abstractmethod
|
||||
from dateutil import parser
|
||||
import pytz
|
||||
|
||||
from fedireads import models
|
||||
|
||||
|
@ -80,6 +82,14 @@ def has_attr(obj, key):
|
|||
return False
|
||||
|
||||
|
||||
def get_date(date_string):
|
||||
''' helper function to try to interpret dates '''
|
||||
try:
|
||||
return pytz.utc.localize(parser.parse(date_string))
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
|
||||
class SearchResult(object):
|
||||
''' standardized search result object '''
|
||||
def __init__(self, title, key, author, year, raw_data):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue