Dalba added a comment.

  In T229293#5418675 <https://phabricator.wikimedia.org/T229293#5418675>, @Huji 
wrote:
  
  > With BotPasswords, the CSRF error was not shown when the first block was 
done. When a second block was attempted, I got a Login failed error. Here are 
some relevant portions of the log:
  >
  >   ...
  >   Checking 5.250.46.252
  >   Checking 109.169.72.36
  >   Logging in to wikipedia:fa as HujiBot@HujiBot
  >   Checking 188.229.7.134
  >   Checking 5.106.138.33
  >   ...
  >   Checking 2A02:A03F:52DB:3500:51F8:75AD:3798:726C
  >   Checking 204.14.73.69
  >   Logging in to wikipedia:fa as HujiBot@HujiBot
  >   ERROR: Login failed (Aborted).
  >   Password for user HujiBot@HujiBot on wikipedia:fa (no characters will be 
shown): 
  >
  > Note that my bot successfully blocked 109.169.72.36 (and that is where the 
first login attempt happened and was successful); later, it tried to block 
204.14.73.69 and, because each block must be preceded with a new login, it 
tried to log in again and failed. This is all using BotPasswords.
  
  I cannot reproduce. The following script worked fine for me:
  
    import pywikibot
    from pywikibot import Site
    
    proxies = ('198.16.74.205', '204.14.73.69', '185.217.117.2')
    
    class FindProxyBot():
    
        def __init__(self):
            self.site = Site('fa', 'wpbeta')
            self.target = 'ویکی‌پدیا:گزارش دیتابیس/کشف پروکسی'
            self.summary = 'روزآمدسازی نتایج (وظیفه ۲۲)'
            self.blocksummary = '{{پروکسی باز}}'
    
        def find_proxies(self):
    
            for ip in proxies:
                pywikibot.output('Checking %s' % ip)
                target = pywikibot.User(self.site, ip)
                if not target.isBlocked():
                    self.site.blockuser(
                        target, '1 year', self.blocksummary,
                        anononly=False, allowusertalk=True)
    
    
    robot = FindProxyBot()
    robot.find_proxies()
  
  Result:
  
    Logging in to wpbeta:fa as Dalba@Dalba
    Checking 198.16.74.205
    Checking 204.14.73.69
    Checking 185.217.117.2
  
  I wonder why you're being prompted for typing your password again, maybe your 
`user-config.py`/`password_file` is not configured properly?
  
  I have the following lines in mine:
  
  user-config.py:
  
    usernames['*']['*'] = 'Dalba'
    sysopnames['*']['*'] = 'Dalba'
    password_file = 'user-password.py'
  
  user-password.py:
  
    ('wpbeta', 'Dalba', BotPassword('Dalba', '<redacted>'))

TASK DETAIL
  https://phabricator.wikimedia.org/T229293

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dalba
Cc: Dalba, Framawiki, Aklapper, Huji, pywikibot-bugs-list, Viztor, DannyS712, 
Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, 
mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to