Handle deleted item for human

This commit is contained in:
Edward Betts 2020-11-01 15:21:27 +00:00
parent 60bb9febd9
commit cb3a9396de

View file

@ -39,7 +39,7 @@ def from_name(name):
found = [] found = []
for entity in mediawiki.get_entities_with_cache(qids, props='labels|descriptions'): for entity in mediawiki.get_entities_with_cache(qids, props='labels|descriptions'):
if 'redirects' in entity: if 'redirects' in entity or 'missing' in entity:
continue continue
qid = entity['id'] qid = entity['id']
item = lookup[qid] item = lookup[qid]
@ -51,7 +51,7 @@ def from_name(name):
label = wikibase.get_entity_label(entity) label = wikibase.get_entity_label(entity)
if label: if label:
i['label'] = label i['label'] = label
if 'en' in entity['descriptions']: if 'en' in entity.get('descriptions', {}):
i['description'] = entity['descriptions']['en']['value'] i['description'] = entity['descriptions']['en']['value']
found.append(i) found.append(i)
found.sort(key=lambda i: i.get('label', '')) found.sort(key=lambda i: i.get('label', ''))