KeyError: "Log entry (rights) has no 'rights' key" occurs when a log event's content has been hidden (revision deletion).
The newgroups (or new) keys do not exist in params in this case.
{ "batchcomplete": "", "query": { "logevents": [ { "logid": 89126214, "actionhidden": "", "type": "rights", "action": "rights", "userhidden": "", "timestamp": "2018-02-16T09:09:40Z", "comment": "Confirmed as recently active IP. Granting 'confirmed' flag manually." } ] } }
>>> site = pywikibot.Site('en', 'wikipedia') >>> rights_event = next(iter(site.logevents(logtype='rights', start='20180216090941', total=1))) >>> rights_event <RightsEntry(wikipedia:en, logid=89126214)> >>> rights_event.data {'type': 'rights', 'logid': 89126214, 'userhidden': '', 'action': 'rights', 'timestamp': '2018-02-16T09:09:40Z', 'comment': "Confirmed as recently active IP. Granting 'confirmed' flag manually.", 'actionhidden': ''} >>> rights_event.newgroups Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/shared/pywikipedia/core/pywikibot/logentries.py", line 280, in newgroups if 'new' in self._params: # old mw style File "/shared/pywikipedia/core/pywikibot/logentries.py", line 87, in _params return self.data[self._expectedType] File "/shared/pywikipedia/core/pywikibot/logentries.py", line 34, in __missing__ raise KeyError("Log entry (%s) has no '%s' key" % (self._type, key)) KeyError: "Log entry (rights) has no 'rights' key"