Handle entity without labels.
This commit is contained in:
parent
2cbc88a947
commit
cc62265a0d
|
@ -5,6 +5,8 @@ def first_datavalue(entity, pid):
|
||||||
return mainsnak['datavalue']['value']
|
return mainsnak['datavalue']['value']
|
||||||
|
|
||||||
def get_entity_label(entity):
|
def get_entity_label(entity):
|
||||||
|
if 'labels' not in entity:
|
||||||
|
return None
|
||||||
if 'en' in entity['labels']:
|
if 'en' in entity['labels']:
|
||||||
return entity['labels']['en']['value']
|
return entity['labels']['en']['value']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue