Page MenuHomePhabricator

delete.py asks for password on *every* deletion
Closed, ResolvedPublic

Description

delete.py keeps asking for the bot's password on every edit:

jesus@charmander:~/git/mediawiki/pywikibot/core> python pwb.py scripts/delete.py -family:wikidex -cat:"Sprites de MTs" -titleregex:"MT[0-9][0-9].png" -summary:"Se deben usar los sprites de MT por tipo, no número" -v -debug
WARNING: /home/jesus/git/mediawiki/pywikibot/core/pywikibot/version.py:100: DeprecationWarning: pywikibot.version.getversion_svn is deprecated; use getversion_svn_setuptools instead.
  (tag, rev, date, hsh) = vcs_func(_program_dir)

WARNING: /home/jesus/git/mediawiki/pywikibot/core/pywikibot/version.py:248: DeprecationWarning: pywikibot.version.svn_rev_info is deprecated; use getversion_svn_setuptools instead.
  tag, rev, date = svn_rev_info(_program_dir)

Pywikibot r343f1bbfdabbbc182e97bea31b2c5d8c6af44b79
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC]
Found 1 wikidex:es processes running, including this one.
Working on u'Archivo:MT48.png'


>>> Archivo:MT48.png <<<
Do you want to delete [[es:Archivo:MT48.png]]? ([y]es, [N]o, [a]ll): y
Password for user PoryBot on wikidex:es (no characters will be shown): 
Logging in to wikidex:es as PoryBot
Should be logged in now
WARNING: /home/jesus/git/mediawiki/pywikibot/core/pywikibot/data/api.py:2348: DeprecationWarning: Instead of using kwargs from Request.__init__, parameters for the request to the API should be added via the "parameters" parameter.
  kwargs = self.request_class.clean_kwargs(kwargs)

WARNING: /home/jesus/git/mediawiki/pywikibot/core/pywikibot/tools/ip.py:78: DeprecationWarning: ipaddress backport not available.
WARNING: /home/jesus/git/mediawiki/pywikibot/core/pywikibot/tools/ip.py:79: DeprecationWarning: page.ip_regexp is deprecated; use tools.ip.is_IP instead.
  if ip_regexp.match(IP) is None:

Working on u'Archivo:MT49.png'


>>> Archivo:MT49.png <<<
Do you want to delete [[es:Archivo:MT49.png]]? ([y]es, [N]o, [a]ll): y
Password for user PoryBot on wikidex:es (no characters will be shown): 
User quit DeletionRobot bot run...

1 pages read
0 pages written
Execution time: 19 seconds
Read operation time: 19 seconds
Script terminated by exception:

ERROR: QuitKeyboardInterrupt: 
Dropped throttle(s).
Closing network session.
Network session closed.

I also deleted the contents of the apicache folder to see if that was the issue (the debug log mentioned things about cached requests)

I even tried to just hit "enter" without filling the password, and the bot deleted the page without problems! so it's obviously logged in. I started doing so for a while, but after 5 logins or so the account was throttled and I'm now unable to make further edits. Great.

I haven't updated pywikibot for months, since it was working as I needed, but then I needed to use -cat along with -titleregex, which was added in october, so I updated it to master.

I'm not sure if the problem is only with delete.py, all scripts are broken, or is a problem with my configuration, which I don't discard because I had a hard time installing the "requests" python module that either wasn't required before or I had an older version that already worked

Event Timeline

Ciencia_Al_Poder raised the priority of this task from to Needs Triage.
Ciencia_Al_Poder updated the task description. (Show Details)
Ciencia_Al_Poder added a project: Pywikibot.
Ciencia_Al_Poder subscribed.

I think this has to do with the fact that the user running the bot is not sysop, but it has delete permissions on the wiki, so the login prompt is unneeded.

I have also this in user-config.py:

usernames['wikidex']['es'] = u'PoryBot'
sysopnames['wikidex']['es'] = u'PoryBot'

Probably has to do with T71283: dualism between user and sysop needs to be overtaken

Looks like the same problem I've reported at T168789: delete.py asking for credentials before each deletion every time, although hitting "enter" didn't make it work, plus my pywikibot version is up to date. The delete.py script comes very useful. Please have a look at this and fix the script if at all possible. Thanks.

Are you added in user-config.py line:

authenticate['language.wikipedia.org'] = ('usernameofyourbot','passwordofbotaccount')
In T122705#3516450, @Zoranzoki21 wrote:

Are you added in user-config.py line:

authenticate['language.wikipedia.org'] = ('usernameofyourbot','passwordofbotaccount')

On language.wikipedia.org i think for example... en.wikipedia.org

authenticate was used for HTTP authentication in pywikibot 2, with using a tuple of two items, username and password. It will not help MediaWiki login. (The same variable is now also used for OAuth since pywikibot 3 with a 4-tuple).

If you want to save passwords in a file, what you want to use is password_file configuration variable.

@MarcoAurelio: Would you mentor this in Google-Code-in-2017? I moved it to "Missing mentors" for the time being.

@Aklapper Unfortunatelly I lack the technical knowledge required, sorry.

[ removing Google-Code-in-2017 as this is not under good first task either and as per last comment ]

Xqt triaged this task as Medium priority.Apr 15 2018, 9:37 AM
In T122705#4850557, @Zoranzoki21 wrote:

I can not reproduce this.

Have you tried with an account that's not a sysop, but is on a group with the delete right (and can normally delete pages with the web interface)?

Xqt raised the priority of this task from Medium to High.Feb 16 2019, 6:59 AM

I was able to reproduce this while trying to use it on zhwiki, and the deletions I had were not even successful. Keep in mind, I was trying to delete on a wiki I was not a sysop, but had deletion permissions for (as a steward).

Change 531589 had a related patch set uploaded (by Huji; owner: Huji):
[pywikibot/core@master] Check a user's rights before checking its group memberships

https://gerrit.wikimedia.org/r/531589

Change 531589 merged by jenkins-bot:
[pywikibot/core@master] Check a user's rights before checking its group memberships

https://gerrit.wikimedia.org/r/531589

Huji claimed this task.
Huji subscribed.

I am assuming r531589 fixed this. Reopen if otherwise.