From cb3a9396de3be7133231b4c409dc6015e2c38646 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 1 Nov 2020 15:21:27 +0000 Subject: [PATCH] Handle deleted item for human --- depicts/human.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depicts/human.py b/depicts/human.py index e5586d0..4547c74 100644 --- a/depicts/human.py +++ b/depicts/human.py @@ -39,7 +39,7 @@ def from_name(name): found = [] 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 qid = entity['id'] item = lookup[qid] @@ -51,7 +51,7 @@ def from_name(name): label = wikibase.get_entity_label(entity) if label: i['label'] = label - if 'en' in entity['descriptions']: + if 'en' in entity.get('descriptions', {}): i['description'] = entity['descriptions']['en']['value'] found.append(i) found.sort(key=lambda i: i.get('label', ''))