import pywikibot from pywikibot import config2 as config config.simulate = True repo = pywikibot.Site("test", "wikidata") item = pywikibot.ItemPage(repo, 'Q167028') item.get() claim = pywikibot.Claim(repo, 'p31') claim.setTarget('http://rien.de') item.addClaim(claim)
SIMULATION: wbcreateclaim action blocked. *** --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-5-3167f370617b> in <module>() 9 claim = pywikibot.Claim(repo, 'p31') 10 claim.setTarget('http://rien.de') ---> 11 item.addClaim(claim) 12 /srv/paws/pwb/pywikibot/page.py in wrapper(self, *args, **kwargs) 125 pywikibot.async_request(handle, func, self, *args, **kwargs) 126 else: --> 127 handle(func, self, *args, **kwargs) 128 129 manage_wrapping(wrapper, func) /srv/paws/pwb/pywikibot/page.py in handle(func, self, *args, **kwargs) 107 err = None 108 try: --> 109 func(self, *args, **kwargs) 110 # TODO: other "expected" error types to catch? 111 except pywikibot.Error as edit_err: /srv/paws/pwb/pywikibot/page.py in addClaim(self, claim, bot, **kwargs) 4559 @type callback: callable 4560 """ -> 4561 self.repo.addClaim(self, claim, bot=bot, **kwargs) 4562 claim.on_item = self 4563 /srv/paws/pwb/pywikibot/site.py in callee(self, *args, **kwargs) 1319 else: 1320 raise Exception("Not implemented") -> 1321 return fn(self, *args, **kwargs) 1322 1323 if not __debug__: /srv/paws/pwb/pywikibot/site.py in addClaim(self, item, claim, bot, summary) 7754 req = self._simple_request(**params) 7755 data = req.submit() -> 7756 claim.snak = data['claim']['id'] 7757 # Update the item 7758 if claim.getID() in item.claims: KeyError: 'claim'