dahlia / wikidata

Wikidata client library for Python
https://pypi.org/project/Wikidata/
GNU General Public License v3.0
337 stars 31 forks source link

How to get "also known as" field #21

Open tbright17 opened 4 years ago

tbright17 commented 4 years ago

As in title, is there a way to get the "also known as" field in wikidata?

Thanks

cdhx commented 4 years ago

As in title, is there a way to get the "also known as" field in wikidata?

Thanks

from wikidata.client import Client
client = Client() 
entity = client.get('Q20145', load=True)
entity.attribute['aliases']['en']#get english “also know as”

@tbright17

dahlia commented 4 years ago

As @cdhx answered, there is the Entity.attributes attribute which has the entire raw data. As of now, you could get “also known as” field through entity.attributes['aliases'].

However, it would be better if we have an attribute/property like Entity.aliases.