Mailing List Archive

Need help to login with pwb.py with a bot account
Hello all,

I am trying to run a pywikibot based bot on toolforge server.

i logged into tool forge.

Cloned the pywikibot.

created the user-config.py and user-password.py with below content.

cat user-config.py
mylang = 'pa'
family = 'wikisource'
usernames['wikisource']['pa'] = 'WD-WS Integration Bot'
usernames['wikidata']['wikidata'] = 'WD-WS Integration Bot'
password_file = "user-password.py"



cat user-password.py
('WD-WS Integration Bot', BotPassword('wd-ws-integration-bot', 'PASSWORD HERE'))

Created bot account at pa.wikisource.org

https://pa.wikisource.org/wiki/User:WD-WS_Integration_Bot

Can login to the pa.wikisource.org with the same user name and credentials.

But, cant login using the command line using pwb.py.

Getting the below error.

tools.wdwsbot@tools-sgebastion-07:~/pywikibot-core$ python3
/data/project/shared/pywikibot/stable/pwb.py login
WARNING: No user is logged in on site wikisource:pa
Logging in to wikisource:pa as WD-WS Integration Bot@wd-ws-integration-bot
Traceback (most recent call last):
File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
line 2931, in login_to_site
response['messagecode'] == 'login-throttled'
KeyError: 'messagecode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/data/project/shared/pywikibot/stable/pwb.py", line 365, in <module>
if not main():
File "/data/project/shared/pywikibot/stable/pwb.py", line 360, in main
file_package)
File "/data/project/shared/pywikibot/stable/pwb.py", line 74, in
run_python_file
main_mod.__dict__)
File "/data/project/shared/pywikibot/stable/scripts/login.py", line
151, in <module>
main()
File "/data/project/shared/pywikibot/stable/scripts/login.py", line
139, in main
site.login(autocreate=autocreate)
File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/_apisite.py",
line 388, in login
if login_manager.login(retry=True, autocreate=autocreate):
File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/login.py",
line 307, in login
self.login_to_site()
File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
line 2939, in login_to_site
'handled:\n{}'.format(response))
pywikibot.exceptions.CaptchaError: Captcha encountered which cannot be handled:
{'result': 'Failed', 'reason': 'Incorrect username or password
entered. Please try again.'}
CRITICAL: Exiting due to uncaught exception <class
'pywikibot.exceptions.CaptchaError'>


Need help to solve this.

Thanks.


--
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
http://FreeTamilEbooks.com
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Need help to login with pwb.py with a bot account [ In reply to ]
Hello T.Shrinivasan,

The relevant portion is {'result': 'Failed', 'reason': 'Incorrect username
or password entered. Please try again.'}.

You should not be using the same password that is used to log in to the web
UI. For a BotPassword, see the configuration steps at
https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords.

Regards,
JJ

On Sat, Jun 19, 2021 at 9:00 AM Shrinivasan T <tshrinivasan@gmail.com>
wrote:

> Hello all,
>
> I am trying to run a pywikibot based bot on toolforge server.
>
> i logged into tool forge.
>
> Cloned the pywikibot.
>
> created the user-config.py and user-password.py with below content.
>
> cat user-config.py
> mylang = 'pa'
> family = 'wikisource'
> usernames['wikisource']['pa'] = 'WD-WS Integration Bot'
> usernames['wikidata']['wikidata'] = 'WD-WS Integration Bot'
> password_file = "user-password.py"
>
>
>
> cat user-password.py
> ('WD-WS Integration Bot', BotPassword('wd-ws-integration-bot', 'PASSWORD
> HERE'))
>
> Created bot account at pa.wikisource.org
>
> https://pa.wikisource.org/wiki/User:WD-WS_Integration_Bot
>
> Can login to the pa.wikisource.org with the same user name and
> credentials.
>
> But, cant login using the command line using pwb.py.
>
> Getting the below error.
>
> tools.wdwsbot@tools-sgebastion-07:~/pywikibot-core$ python3
> /data/project/shared/pywikibot/stable/pwb.py login
> WARNING: No user is logged in on site wikisource:pa
> Logging in to wikisource:pa as WD-WS Integration Bot@wd-ws-integration-bot
> Traceback (most recent call last):
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
> line 2931, in login_to_site
> response['messagecode'] == 'login-throttled'
> KeyError: 'messagecode'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/data/project/shared/pywikibot/stable/pwb.py", line 365, in <module>
> if not main():
> File "/data/project/shared/pywikibot/stable/pwb.py", line 360, in main
> file_package)
> File "/data/project/shared/pywikibot/stable/pwb.py", line 74, in
> run_python_file
> main_mod.__dict__)
> File "/data/project/shared/pywikibot/stable/scripts/login.py", line
> 151, in <module>
> main()
> File "/data/project/shared/pywikibot/stable/scripts/login.py", line
> 139, in main
> site.login(autocreate=autocreate)
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/_apisite.py",
> line 388, in login
> if login_manager.login(retry=True, autocreate=autocreate):
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/login.py",
> line 307, in login
> self.login_to_site()
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
> line 2939, in login_to_site
> 'handled:\n{}'.format(response))
> pywikibot.exceptions.CaptchaError: Captcha encountered which cannot be
> handled:
> {'result': 'Failed', 'reason': 'Incorrect username or password
> entered. Please try again.'}
> CRITICAL: Exiting due to uncaught exception <class
> 'pywikibot.exceptions.CaptchaError'>
>
>
> Need help to solve this.
>
> Thanks.
>
>
> --
> Regards,
> T.Shrinivasan
>
>
> My Life with GNU/Linux : http://goinggnu.wordpress.com
> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>
> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
> http://FreeTamilEbooks.com
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
Re: Need help to login with pwb.py with a bot account [ In reply to ]
This is interesting, 2-3 days I tried to use the mediawiki API from a bot
account and it was not successful. But when i tried to do the same from my
administrator account all the API was working fine.

I tried that on Mediawiki 1.35.2 on a fresh local installation.

--
*Nasir Khan Saikat*
www.nasirkhn.com



On Sat, 19 Jun 2021 at 22:00, Shrinivasan T <tshrinivasan@gmail.com> wrote:

> Hello all,
>
> I am trying to run a pywikibot based bot on toolforge server.
>
> i logged into tool forge.
>
> Cloned the pywikibot.
>
> created the user-config.py and user-password.py with below content.
>
> cat user-config.py
> mylang = 'pa'
> family = 'wikisource'
> usernames['wikisource']['pa'] = 'WD-WS Integration Bot'
> usernames['wikidata']['wikidata'] = 'WD-WS Integration Bot'
> password_file = "user-password.py"
>
>
>
> cat user-password.py
> ('WD-WS Integration Bot', BotPassword('wd-ws-integration-bot', 'PASSWORD
> HERE'))
>
> Created bot account at pa.wikisource.org
>
> https://pa.wikisource.org/wiki/User:WD-WS_Integration_Bot
>
> Can login to the pa.wikisource.org with the same user name and
> credentials.
>
> But, cant login using the command line using pwb.py.
>
> Getting the below error.
>
> tools.wdwsbot@tools-sgebastion-07:~/pywikibot-core$ python3
> /data/project/shared/pywikibot/stable/pwb.py login
> WARNING: No user is logged in on site wikisource:pa
> Logging in to wikisource:pa as WD-WS Integration Bot@wd-ws-integration-bot
> Traceback (most recent call last):
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
> line 2931, in login_to_site
> response['messagecode'] == 'login-throttled'
> KeyError: 'messagecode'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/data/project/shared/pywikibot/stable/pwb.py", line 365, in <module>
> if not main():
> File "/data/project/shared/pywikibot/stable/pwb.py", line 360, in main
> file_package)
> File "/data/project/shared/pywikibot/stable/pwb.py", line 74, in
> run_python_file
> main_mod.__dict__)
> File "/data/project/shared/pywikibot/stable/scripts/login.py", line
> 151, in <module>
> main()
> File "/data/project/shared/pywikibot/stable/scripts/login.py", line
> 139, in main
> site.login(autocreate=autocreate)
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/_apisite.py",
> line 388, in login
> if login_manager.login(retry=True, autocreate=autocreate):
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/login.py",
> line 307, in login
> self.login_to_site()
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
> line 2939, in login_to_site
> 'handled:\n{}'.format(response))
> pywikibot.exceptions.CaptchaError: Captcha encountered which cannot be
> handled:
> {'result': 'Failed', 'reason': 'Incorrect username or password
> entered. Please try again.'}
> CRITICAL: Exiting due to uncaught exception <class
> 'pywikibot.exceptions.CaptchaError'>
>
>
> Need help to solve this.
>
> Thanks.
>
>
> --
> Regards,
> T.Shrinivasan
>
>
> My Life with GNU/Linux : http://goinggnu.wordpress.com
> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>
> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
> http://FreeTamilEbooks.com
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
Re: Need help to login with pwb.py with a bot account [ In reply to ]
> The relevant portion is {'result': 'Failed', 'reason': 'Incorrect username or password entered. Please try again.'}.
>
> You should not be using the same password that is used to log in to the web UI. For a BotPassword, see the configuration steps at https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords.
>
Thanks JJ for the immediate reply.

Created a new bot password and it works well.


--
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
http://FreeTamilEbooks.com
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/