Get description of a Wikidata property? -
how can human readable property description of wikidata property (e.g.: p31) using pywikibot?
you can use action=wbgetentities
properties, normal item.
to human readable descriptions p31
:
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=p31
and limit results 1 language (english):
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=p31&languages=en
using pywikibot task seems bit of overkill (pywikibot framework building bots mass editing , like, on wikipedia). i'm not sure it's possible.
there other, more lightweight frameworks, wikitools. wikitools, this:
from wikitools import wiki, apirequest pid = "p31" endpoint = "http://commons.wikimedia.org/w/api.php" username = "xxx" password = "xxx" site = wiki(endpoint, username, password) params = {'action':'wbgetentities', 'ids': pid} request = apirequest(site, params) result = request.query() print result["entities"][pid]["descriptions"]
Comments
Post a Comment