1
0
Fork 0

Use timezone dates

Fixes #114
This commit is contained in:
Mouse Reeve 2020-03-29 17:40:51 -07:00
parent da69b82d8a
commit 9aada80c05
9 changed files with 61 additions and 43 deletions

View file

@ -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):