Hi everyone,
My bot has started throwing the following error, and I'm wondering if anyone has a clue about what might have changed. It's using the shared stable version on ToolForge, which I believe was updated to 8.0.3. today. TIA for any help.
File "/data/project/william-avery-bot/wikipythonics/cleanseRefs.py", line 118, in treat_page self.current_page.editEntity(summary=summary) File "/data/project/shared/pywikibot/stable/pywikibot/page/_decorators.py", line 55, in wrapper handle(func, self, *args, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/page/_decorators.py", line 34, in handle func(self, *args, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/page/_wikibase.py", line 680, in editEntity super().editEntity(data, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/page/_wikibase.py", line 313, in editEntity updates = self.repo.editEntity( File "/data/project/shared/pywikibot/stable/pywikibot/site/_decorators.py", line 92, in callee return fn(self, *args, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/site/_datasite.py", line 311, in editEntity params['token'] = self.tokens['csrf'] File "/data/project/shared/pywikibot/stable/pywikibot/site/_tokenwallet.py", line 57, in __getitem__ raise KeyError( KeyError: "Invalid token 'csrf' for user 'William Avery Bot' on wikidata:wikidata wiki."
I had a look at recent code changes, and decided to try changing the authentication from bot password to OAuth, which fixed my problem.
It's odd that the issue only affected a bot that updates using an edit_entity() call, and not one that updates with setSitelink().
On Thu, 13 Apr 2023 at 18:01, William Avery willm.avery@gmail.com wrote:
Hi everyone,
My bot has started throwing the following error, and I'm wondering if anyone has a clue about what might have changed. It's using the shared stable version on ToolForge, which I believe was updated to 8.0.3. today. TIA for any help.
File "/data/project/william-avery-bot/wikipythonics/cleanseRefs.py", line 118, in treat_page self.current_page.editEntity(summary=summary) File "/data/project/shared/pywikibot/stable/pywikibot/page/_decorators.py", line 55, in wrapper handle(func, self, *args, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/page/_decorators.py", line 34, in handle func(self, *args, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/page/_wikibase.py", line 680, in editEntity super().editEntity(data, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/page/_wikibase.py", line 313, in editEntity updates = self.repo.editEntity( File "/data/project/shared/pywikibot/stable/pywikibot/site/_decorators.py", line 92, in callee return fn(self, *args, **kwargs) File "/data/project/shared/pywikibot/stable/pywikibot/site/_datasite.py", line 311, in editEntity params['token'] = self.tokens['csrf'] File "/data/project/shared/pywikibot/stable/pywikibot/site/_tokenwallet.py", line 57, in __getitem__ raise KeyError( KeyError: "Invalid token 'csrf' for user 'William Avery Bot' on wikidata:wikidata wiki."