Repository URL to install this package:
|
Version:
0.32.0 ▾
|
import logging
import json
log = logging.getLogger(__name__)
def flatten(key, items):
if items is None:
return []
return [item.get(key) for item in items if item.get(key)]
class DatetimeEncoder(json.JSONEncoder):
"""
Alternate handler that can serialize dates
"""
def default(self, obj):
if hasattr(obj, 'isoformat'):
return obj.isoformat()
# Let the base class default method raise the TypeError
return json.JSONEncoder.default(self, obj)