Handle case where description is missing from LD.

This commit is contained in:
Edward Betts 2019-09-29 08:40:19 +01:00
parent fecab79bba
commit 39d2760ab9

View file

@ -27,10 +27,12 @@ def parse_html(html):
def get_catalog(saam_id): def get_catalog(saam_id):
data = parse_html(get_html(saam_id)) data = parse_html(get_html(saam_id))
return { ret = {
'institution': 'Smithsonian American Art Museum', 'institution': 'Smithsonian American Art Museum',
'keywords': data['keywords'], 'keywords': data['keywords'],
'description': data['ld']['description']
} }
if 'description' in data['ld']:
ret['description'] = data['ld']['description']
return ret