add per list export_json
This commit is contained in:
parent
0cd6032816
commit
b961086475
4 changed files with 31 additions and 12 deletions
|
|
@ -383,3 +383,11 @@ def can_connect_dns(host="8.8.8.8", port=53):
|
|||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
def _to_json(python_object):
|
||||
if isinstance(python_object, datetime):
|
||||
if python_object.year < 1900:
|
||||
tt = python_object.timetuple()
|
||||
return '%d-%02d-%02dT%02d:%02d%02dZ' % tuple(list(tt)[:6])
|
||||
return python_object.strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||
raise TypeError(u'%s %s is not JSON serializable' % (repr(python_object), type(python_object)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue