http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11435
Revision: 11435 Author: drtrigon Date: 2013-04-22 20:57:35 +0000 (Mon, 22 Apr 2013) Log Message: ----------- bug fix; KeyError: 'claim' (partly reverts/corrects r11382)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2013-04-22 18:57:15 UTC (rev 11434) +++ trunk/pywikipedia/wikipedia.py 2013-04-22 20:57:35 UTC (rev 11435) @@ -4312,7 +4312,7 @@ value = "{"entity-type":"item","numeric-id":%s}" % value else: pass - claims = self.get()['claims'] if 'claims' in self.get() else [] + claims = self.get()['claims'] theclaim = None for claim in claims: if claim['m'][1] == propertyID: @@ -4352,7 +4352,7 @@ raise RuntimeError("API query error: %s" % data) if 'warnings' in data: output(str(data[u'warnings'])) - guid=data['claim']['id'] + guid=data['claim']['id'] if 'claim' in data else '' if refs: snak = [] if isinstance(refs, dict):