Page MenuHomePhabricator

Reduce (API) warning clutter in login.py after clean installation
Open, LowestPublic

Description

Steps to reproduce

  1. Follow steps of https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation like a new user

Expected behavior

$ python pwb.py login
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logged in on wikipedia:cs as DvorapaBot.

Current behavior

$ python pwb.py login
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logging in to wikipedia:cs as DvorapaBot
WARNING: API warning (main): Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes. Use [[Special:ApiFeatureUsage]] to see usage of deprecated features by your application.
WARNING: API warning (login): Main-account login via "action=login" is deprecated and may stop working without warning. To continue login with "action=login", see [[Special:BotPasswords]]. To safely continue using main-account login, see "action=clientlogin".
Logged in on wikipedia:cs as DvorapaBot.

Configuration
Python 3.6.2, latest commit in pywikibot master

Event Timeline

Xqt triaged this task as Lowest priority.Oct 12 2017, 2:41 PM
Dvorapa renamed this task from Reduce API warning clutter in login.py after clean installation to Reduce (API) warning clutter in login.py after clean installation.Oct 6 2018, 2:22 PM
$ python pwb.py login -logout
Logged out of wikipedia:cs.
$ python pwb.py login
WARNING: No user is logged in on site wikipedia:cs
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logging in to wikipedia:cs as DvorapaBot
Logged in on wikipedia:cs as DvorapaBot.

Well, the major issue yes, do we want to consolidate also these messages into one? Like:

$ python pwb.py login
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logged in on wikipedia:cs as DvorapaBot.

Or perhaps merge their styles? (remove unnecessary "WARNING:" prefix)

$ python pwb.py login
No user is logged in on site wikipedia:cs
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logging in to wikipedia:cs as DvorapaBot
Logged in on wikipedia:cs as DvorapaBot

What do you think?

$ python pwb.py login -logout
Logged out of wikipedia:cs.
$ python pwb.py login
WARNING: No user is logged in on site wikipedia:cs
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logging in to wikipedia:cs as DvorapaBot
Logged in on wikipedia:cs as DvorapaBot.

Well, the major issue yes, do we want to consolidate also these messages into one? Like:

$ python pwb.py login
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logged in on wikipedia:cs as DvorapaBot.

Or perhaps merge their styles? (remove unnecessary "WARNING:" prefix)

$ python pwb.py login
No user is logged in on site wikipedia:cs
Password for user DvorapaBot on wikipedia:cs (no characters will be shown): 
Logging in to wikipedia:cs as DvorapaBot
Logged in on wikipedia:cs as DvorapaBot

What do you think?

I am for second option without warnings. Pywikibot shouldn't show WARNING: No user is logged in on site wikipedia:cs as python pwb.py login is for it.

Change 804704 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Do not show a warning if login is in progress

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

Hi @Xqt, I received an email for a user asking if the warning below indicate their IP address is at risk of being compromised (due to accidental logout)

WARNING: No user is logged in on site wikipedia:zh

image.png (842×2 px, 233 KB)

It seems that such warning message is relevant to this task and your patch, so is there any progress about this task? Thanks.

Hi @Xqt, I received an email for a user asking if the warning below indicate their IP address is at risk of being compromised (due to accidental logout)

WARNING: No user is logged in on site wikipedia:zh

It seems that such warning message is relevant to this task and your patch, so is there any progress about this task? Thanks.

Wasn't able to reproduce this with neither Pywikibot 8.0.3 not 8.1. Which version are you using?
The MW API would deny any change because logged in user is enforced with the api string. I get the following:

Pywikibot 8.1.0dev3

D:\pwb\GIT\core>pwb add_text -text:"T178061 test logged out" -page:user:Xqt/Test


>>> Benutzer:Xqt/Test <<<
@@ -55 +55,2 @@
- -->
+ -->
+ T178061 test logged out

Edit summary: Bot: T178061 test logged out hinzugefügt
Do you want to accept these changes? ([y]es, [N]o, [a]ll, [q]uit): y
Password for user Xqtest on wikipedia:de (no characters will be shown):
ERROR: Skipping Benutzer:Xqt/Test because of a save related error: Edit to page [[Benutzer:Xqt/Test]] failed:
Username 'Xqtest' does not have read permissions on wikipedia:de.
Die angegebenen Anmeldeinformationen konnten nicht überprüft werden.

1 read operation
Execution time: 18 seconds
Read operation time: 18.0 seconds
Script terminated successfully.

Pywikibot 8.0.3

D:\pwb\GIT\core>pwb add_text -text:"T178061 test logged out" -page:user:Xqt/Test


>>> Benutzer:Xqt/Test <<<
@@ -55 +55,2 @@
- -->
+ -->
+ T178061 test logged out

Edit summary: Bot: T178061 test logged out hinzugefügt
Do you want to accept these changes? ([y]es, [N]o, [a]ll, [q]uit): y
WARNING: No user is logged in on site wikipedia:de
WARNING: No user is logged in on site wikipedia:de
Password for user Xqtest on wikipedia:de (no characters will be shown):
Logging in to wikipedia:de as Xqtest
ERROR: Skipping Benutzer:Xqt/Test because of a save related error: Edit to page [[Benutzer:Xqt/Test]] failed:
Username 'Xqtest' does not have read permissions on wikipedia:de.
Die angegebenen Anmeldeinformationen konnten nicht überprüft werden.

1 read operation
Execution time: 13 seconds
Read operation time: 13.0 seconds
Script terminated successfully.

D:\pwb\GIT\core>

Hi @Xqt, I am the one who made this screenshot. I'm not really sure if my installation process is correct, but it probably seems to be working so far. I must say that the current installation tutorial is somewhat ... confusing, I can't be sure whether I can simply pip install pywikibot and it can work, or if I have to download the package on github again. Anyway, here's how it goes:

  • I installed pywikibot with pip install, on the C drive.
  • Since the structure of pywikibot installed with pip install is very different from the one installed with github packages (the former has only one layer, the latter has two or three layers), I downloaded a separate copy of pywikibot-core on drive E. The user configuration is also configured on the E drive.
  • The pwb works fine, but the other scripts of pwb don't run - it's not possible to run the command "pwb add_text", returning a file not found.
  • Under Stang's guidance, I used the command "pwb E:/PATH/scripts/add_text.py", and this time it worked, but then this warning appeared, and the actual edit did not reveal the IP, see: result here.
  • I've tried to fix it. I haven't tried to fix it further due to complete lack of knowledge about the system and some recent personal matters, but my previous attempts to reconfigure it separately on the C drive were unsuccessful for unknown reasons.
  • Reproducible on my machine.

Environment:

  • Pywikibot: 8.0.3
  • System: Windows 11
  • Python: Python 3.11.2

Change 804704 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Do not show a warning if password is entered

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