jenkins-bot has submitted this change and it was merged.
Change subject: Add function to determine datatype of a wikidata property via API instead of via "isinstance" ......................................................................
Add function to determine datatype of a wikidata property via API instead of via "isinstance"
Bug: 54543 Change-Id: Ie7ebb9b2d3636b5e4f98c42ff81422359cf07cd3 --- M wikipedia.py 1 file changed, 9 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
Objections: Ladsgroup: There's a problem with this change, please improve
diff --git a/wikipedia.py b/wikipedia.py index bddc1d7..51c60ca 100644 --- a/wikipedia.py +++ b/wikipedia.py @@ -4649,6 +4649,15 @@ return 302, response.msg, data['success'] return response.code, response.msg, data
+ def getPropertyType(self, prop): + params = { + 'action': 'wbgetentities', + 'ids': prop, + 'props': 'datatype', + } + data = query.GetData(params, self.site()) + return data['entities']['datatype'] + def editclaim(self, WDproperty, value, data_type=None, raw_value=False, refs=None, comment=None, token=None, sysop=False, botflag=True):
pywikibot-commits@lists.wikimedia.org