http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11140
Revision: 11140 Author: legoktm Date: 2013-02-28 17:18:29 +0000 (Thu, 28 Feb 2013) Log Message: ----------- wbgetitems API module was renamed to wbgetentities
Modified Paths: -------------- branches/rewrite/pywikibot/site.py
Modified: branches/rewrite/pywikibot/site.py =================================================================== --- branches/rewrite/pywikibot/site.py 2013-02-28 10:30:52 UTC (rev 11139) +++ branches/rewrite/pywikibot/site.py 2013-02-28 17:18:29 UTC (rev 11140) @@ -3249,26 +3249,26 @@ """generic method to get the data for multiple Wikibase items""" wbdata = self.get_item(source, props=props, **params) assert props in wbdata, \ - "API wbgetitems response lacks %s key" % props + "API wbgetentities response lacks %s key" % props return wbdata[props]
def get_item(self, source, **params): """get the data for multiple Wikibase items""" if type(source) == int or \ isinstance(source, basestring) and source.isdigit(): - ids = str(source) - wbrequest = api.Request(site=self, action="wbgetitems", ids=ids, + ids = 'q'+str(source) + wbrequest = api.Request(site=self, action="wbgetentities", ids=ids, **params) wbdata = wbrequest.submit() assert 'success' in wbdata, \ - "API wbgetitems response lacks 'success' key" + "API wbgetentities response lacks 'success' key" assert wbdata['success'] == 1, \ "API 'success' key ist not 1" - assert 'items' in wbdata, \ - "API wbgetitems response lacks 'items' key" - assert ids in wbdata['items'], \ - "API wbgetitems response lacks %s key" % ids - return wbdata['items'][ids] + assert 'entities' in wbdata, \ + "API wbgetentities response lacks 'entities' key" + assert ids in wbdata['entities'], \ + "API wbgetentities response lacks %s key" % ids + return wbdata['entities'][ids] else: # not implemented yet raise NotImplementedError
pywikipedia-svn@lists.wikimedia.org