Fix an error with photos hashes in the fetch command
This commit is contained in:
parent
35c902d3d3
commit
dc9392e6f0
@ -15,6 +15,7 @@ import math
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import imagehash
|
||||||
import mapbox
|
import mapbox
|
||||||
import requests
|
import requests
|
||||||
import unidecode
|
import unidecode
|
||||||
@ -128,7 +129,13 @@ class DateAwareJSONEncoder(json.JSONEncoder):
|
|||||||
def default(self, o): # pylint: disable=locally-disabled,E0202
|
def default(self, o): # pylint: disable=locally-disabled,E0202
|
||||||
if isinstance(o, (datetime.date, datetime.datetime)):
|
if isinstance(o, (datetime.date, datetime.datetime)):
|
||||||
return o.isoformat()
|
return o.isoformat()
|
||||||
return json.JSONEncoder.default(self, o)
|
try:
|
||||||
|
return json.JSONEncoder.default(self, o)
|
||||||
|
except TypeError:
|
||||||
|
# Discard image hashes
|
||||||
|
if isinstance(o, imagehash.ImageHash):
|
||||||
|
return None
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
def pretty_json(data):
|
def pretty_json(data):
|
||||||
|
Loading…
Reference in New Issue
Block a user