This experiment was the initial reason for my post. I have one bot configured and I tried to protect some pages. This is stack trace from this experiment:
File "/home/esommer/workspace/WS_THEbotIT/service/protect.py", line 47, in task lemma.protect(reason="Schutz fertiger Seiten", File "/home/esommer/workspace/WS_THEbotIT/venv/lib/python3.10/site-packages/pywikibot/page/_pages.py", line 1998, in protect self.site.protect(self, protections, reason, **kwargs) File "/home/esommer/workspace/WS_THEbotIT/venv/lib/python3.10/site-packages/pywikibot/site/_decorators.py", line 89, in callee raise UserRightsError('User "{}" does not have required ' pywikibot.exceptions.UserRightsError: User "None" does not have required user right "protect"
The User "None" seems concerning. Is there a chance I screwed up the scopes when I generated the OAuth token at https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose/oa...
Cheers Erik
On 06.09.22 07:42, Johnuniq wrote:
I don't know but many years ago I ran an admin bot on a non-WMF wiki. A separate sysopnames variable was used to specify a user with admin credentials. Sysopnames was removed from pywikibot and whereas I've never used it, the theory is that now you have only a single bot user as defined in usernames. Pywikibot uses that user for normal actions and for admin actions. If admin privilege is needed, I think it first checks if the user has the required privilege. Some info on what I'm saying is at https://www.mail-archive.com/pywikibot@lists.wikimedia.org/msg00712.html
So if you had usernames['wikisource']['de'] = 'Example'
where Example has the bot and sysop flags, it should work. Try a simple script to delete a junk user subpage and report what happens. I don't know if it's possible with MediaWiki, but it's conceivable that pywikibot does not give itself admin credentials unless required (which might explain your debug results).
Johnuniq
On Tue, Sep 6, 2022 at 3:43 AM Erik Sommer ersotech@posteo.de wrote:
No worries,
I do software dev for a living. It's all local and no one is checking in credentials. But that wasn't really the question here.
On 05.09.22 17:21, Roy Smith wrote:
I'm a total newbie at pywikibot, but let me address the general issue of putting credentials in config files.
Be very wary of how you store credentials. You should make sure they're in a file which is read-protected, and not in source control. Otherwise the entire world will have access to your secret credentials.
On Sep 5, 2022, at 10:14 AM, Erik Sommer ersotech@posteo.de wrote:
Hi list,
I operate currently a bot on the German Wikisource. The bot was granted both groups, admin and bot. It is intended to be used as automated protection bot. I'm having trouble to put the right credentials in my user-config.py.
It is currently coded like following pseudo-code:
# -*- coding: utf-8 -*-
family = 'wikisource' mylang = 'de' usernames['wikisource']['de'] = '******'
authenticate['de.wikisource.org'] = (....*****.....)
the problem with this is that the framework only detect my bot as bot not as sysadmin. Groups taken from the debugging output: ['bot', '*', 'user', 'autoconfirmed']
What do I have to add to my config, that the bot also get picket up as sysadmin? I already read (https://www.mediawiki.org/wiki/Manual:Pywikibot/user-config.py) but doesn't make sense for me. It will not change anything if add the botname a second time to the usernames dictionary.
Best Regards
Erik Sommer
pywikibot mailing list -- pywikibot@lists.wikimedia.org To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
pywikibot mailing list -- pywikibot@lists.wikimedia.org To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
pywikibot mailing list -- pywikibot@lists.wikimedia.org To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org
pywikibot mailing list -- pywikibot@lists.wikimedia.org To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org