Hi,
I use Pywikibot compat (the old version), which is now broken, and nobody wants to correct it. So I tried to to it myself. The error is with the API login.
The original method (which worked previously) is: 'action': 'login', 'lgname': self.username, 'lgpassword': self.password, With this I get an error. Thr resulting data strucure has a warnings key, and I printed the value of warnings:
{u'login': {u'*': u'Fetching a token via action=login is deprecated. Use action=query&meta=tokens&type=login instead.'}} Then I went to https://www.mediawiki.org/wiki/API:Login. Here is stated something completely else: action=clientlogin
So which one is right? What is the next step?
My wiki is Hungarian Wikipedia.
On Sun, Sep 4, 2016 at 12:50 PM, Bináris wikiposta@gmail.com wrote:
{u'login': {u'*': u'Fetching a token via action=login is deprecated. Use action=query&meta=tokens&type=login instead.'}} Then I went to https://www.mediawiki.org/wiki/API:Login. Here is stated something completely else: action=clientlogin
The intro section of that page explains which action to use. I don't think the compat branch of Pywikibot supports OAuth; it definitely does not support action=clientlogin (which is not meant for bots). It will work with action=login and bot passwords [1] after [2] is merged.
[1] https://www.mediawiki.org/wiki/Manual:Bot_passwords [2] https://gerrit.wikimedia.org/r/#/c/306133/
I found bot passwords, but they offer very limited user rights. So the best thing is to try without API?
2016-09-06 0:24 GMT+02:00 Gergo Tisza gtisza@wikimedia.org:
On Sun, Sep 4, 2016 at 12:50 PM, Bináris wikiposta@gmail.com wrote:
{u'login': {u'*': u'Fetching a token via action=login is deprecated. Use action=query&meta=tokens&type=login instead.'}} Then I went to https://www.mediawiki.org/wiki/API:Login. Here is stated something completely else: action=clientlogin
The intro section of that page explains which action to use. I don't think the compat branch of Pywikibot supports OAuth; it definitely does not support action=clientlogin (which is not meant for bots). It will work with action=login and bot passwords [1] after [2] is merged.
[1] https://www.mediawiki.org/wiki/Manual:Bot_passwords [2] https://gerrit.wikimedia.org/r/#/c/306133/ _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
you can still login via the API,without having to use either oauth or botpassword
On Mon, Sep 5, 2016 at 11:08 PM, Bináris wikiposta@gmail.com wrote:
I found bot passwords, but they offer very limited user rights. So the best thing is to try without API?
2016-09-06 0:24 GMT+02:00 Gergo Tisza gtisza@wikimedia.org:
On Sun, Sep 4, 2016 at 12:50 PM, Bináris wikiposta@gmail.com wrote:
{u'login': {u'*': u'Fetching a token via action=login is deprecated.
Use
action=query&meta=tokens&type=login instead.'}} Then I went to https://www.mediawiki.org/wiki/API:Login. Here is stated something completely else: action=clientlogin
The intro section of that page explains which action to use. I don't think the compat branch of Pywikibot supports OAuth; it
definitely
does not support action=clientlogin (which is not meant for bots). It
will
work with action=login and bot passwords [1] after [2] is merged.
[1] https://www.mediawiki.org/wiki/Manual:Bot_passwords [2] https://gerrit.wikimedia.org/r/#/c/306133/ _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- Bináris _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Bináris wrote:
I found bot passwords, but they offer very limited user rights. So the best thing is to try without API?
I don't know enough about your requirements to say for sure, but in my uninformed opinion, the best thing would be to switch from Pywikibot Compat to Pywikibot core. :-) Looking at pages such as https://www.mediawiki.org/wiki/Manual:Pywikibot/Compat/deprecation, it seems the Compat version of Pywikibot is completely dead and no longer supported. Retrofitting Compat to support current login code doesn't sound like fun to me.
I think the API documentation should probably be made a bit clearer as I think there are now two deprecated ways of logging in. We should likely make it more explicit which way applies to which versions of MediaWiki. This allows developers to have a quicker and easier understanding when determining how much compatibility code is needed in a specific tool/script/application.
MZMcBride
2016-09-06 6:57 GMT+02:00 MZMcBride z@mzmcbride.com:
I don't know enough about your requirements to say for sure, but in my uninformed opinion, the best thing would be to switch from Pywikibot Compat to Pywikibot core. :-)
This is a long story, and the talk has its own place. I do have the reason to use compat, and there are many users in the solar system.
Looking at pages such as https://www.mediawiki.org/wiki/Manual:Pywikibot/Compat/deprecation, it seems the Compat version of Pywikibot is completely dead and no longer supported. Retrofitting Compat to support current login code doesn't sound like fun to me.
No, it is not dead, but there are people who like to state that. It has plenty of users. You might say, those instances run on older MW installs where the login is fine. But there are still Wikimedia projects with interwikis (not switched to Wikidata yet), and interwiki bot owners like compat for some reason. Catch 22. What I try to do at the moment, is just the support, so "no longer supported" is not the case. (Yeah, I do it for myself, but if I succeed, the result will be published.)
I think the API documentation should probably be made a bit clearer as I think there are now two deprecated ways of logging in. We should likely make it more explicit which way applies to which versions of MediaWiki. This allows developers to have a quicker and easier understanding when determining how much compatibility code is needed in a specific tool/script/application.
Yes, I appreciate.
I can confirn that the interwiki script in compat is better than the core version. :(
On Tue, 6 Sep 2016 12:53 Bináris, wikiposta@gmail.com wrote:
2016-09-06 6:57 GMT+02:00 MZMcBride z@mzmcbride.com:
I don't know enough about your requirements to say for sure, but in my uninformed opinion, the best thing would be to switch from Pywikibot Compat to Pywikibot core. :-)
This is a long story, and the talk has its own place. I do have the reason to use compat, and there are many users in the solar system.
Looking at pages such as https://www.mediawiki.org/wiki/Manual:Pywikibot/Compat/deprecation, it seems the Compat version of Pywikibot is completely dead and no longer supported. Retrofitting Compat to support current login code doesn't sound like fun to me.
No, it is not dead, but there are people who like to state that. It has plenty of users. You might say, those instances run on older MW installs where the login is fine. But there are still Wikimedia projects with interwikis (not switched to Wikidata yet), and interwiki bot owners like compat for some reason. Catch 22. What I try to do at the moment, is just the support, so "no longer supported" is not the case. (Yeah, I do it for myself, but if I succeed, the result will be published.)
I think the API documentation should probably be made a bit clearer as I think there are now two deprecated ways of logging in. We should likely make it more explicit which way applies to which versions of MediaWiki. This allows developers to have a quicker and easier understanding when determining how much compatibility code is needed in a specific tool/script/application.
Yes, I appreciate. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Mon, Sep 5, 2016 at 9:57 PM, MZMcBride z@mzmcbride.com wrote:
I think the API documentation should probably be made a bit clearer as I think there are now two deprecated ways of logging in. We should likely make it more explicit which way applies to which versions of MediaWiki. This allows developers to have a quicker and easier understanding when determining how much compatibility code is needed in a specific tool/script/application.
Using action=login is deprecated since 1.27, unless you use bot passwords. Using action=clientlogin is not deprecated. Using OAuth (which means not logging in at all) is also not deprecated. Bot passwords and clientlogin were added in 1.27; OAuth was added a while ago (although owner-only OAuth consumers were added in 1.27, and adding OAuth support to a bot is a lot more complex without those) but requires the OAuth extension to be installed. HTH.
On Tue, Sep 6, 2016 at 1:59 AM, Gergo Tisza gtisza@wikimedia.org wrote:
On Mon, Sep 5, 2016 at 9:57 PM, MZMcBride z@mzmcbride.com wrote:
I think the API documentation should probably be made a bit clearer as I think there are now two deprecated ways of logging in. We should likely make it more explicit which way applies to which versions of MediaWiki. This allows developers to have a quicker and easier understanding when determining how much compatibility code is needed in a specific tool/script/application.
Using action=login is deprecated since 1.27, unless you use bot passwords. Using action=clientlogin is not deprecated. Using OAuth (which means not logging in at all) is also not deprecated. Bot passwords and clientlogin were added in 1.27; OAuth was added a while ago (although owner-only OAuth consumers were added in 1.27, and adding OAuth support to a bot is a lot more complex without those) but requires the OAuth extension to be installed. HTH.
In addition, when using action=login there are multiple ways to fetch the necessary CSRF token. The not-deprecated method is to use action=query&meta=tokens&type=login. The deprecated (since 1.27) method most likely in use by old code is to send an action=login request without an lgtoken parameter to get a NeedToken response. There's also the possibility of using the deprecated (since 1.24) action=tokens instead of action=query&meta=tokens.
On Mon, Sep 5, 2016 at 8:08 PM, Bináris wikiposta@gmail.com wrote:
I found bot passwords, but they offer very limited user rights.
They offer rights for anything which is defined in $wgGrantPermissions [1], which should be include everything a bot might need. Feel free to file a bug if that's not the case, but maybe you are just overlooking something?
So the best thing is to try without API?
The best thing is to use a bot framework that is still being maintained, so that you don't have to deal with login yourself. The second best thing is to use OAuth with an owner-only consumer [2] and add the Authorization header to every request. The third best thing is to use action=login with a bot password. Anything lower down in bestness should probably be avoided.
On Mon, Sep 5, 2016 at 9:32 PM, John phoenixoverride@gmail.com wrote:
you can still login via the API,without having to use either oauth or botpassword
You might be able to. It depends on the authentication settings of the wiki and the user account. It's not something that should be relied upon.
[1] https://www.mediawiki.org/wiki/Manual:$wgGrantPermissions [2] https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers
2016-09-06 8:14 GMT+02:00 Gergo Tisza gtisza@wikimedia.org:
On Mon, Sep 5, 2016 at 8:08 PM, Bináris wikiposta@gmail.com wrote:
I found bot passwords, but they offer very limited user rights.
They offer rights for anything which is defined in $wgGrantPermissions [1], which should be include everything a bot might need. Feel free to file a bug if that's not the case, but maybe you are just overlooking something?
So the best thing is to try without API?
The best thing is to use a bot framework that is still being maintained, so that you don't have to deal with login yourself. The second best thing is to use OAuth with an owner-only consumer [2] and add the Authorization header to every request. The third best thing is to use action=login with a bot password. Anything lower down in bestness should probably be avoided.
On Mon, Sep 5, 2016 at 9:32 PM, John phoenixoverride@gmail.com wrote:
you can still login via the API,without having to use either oauth or botpassword
You might be able to. It depends on the authentication settings of the wiki and the user account. It's not something that should be relied upon.
[1] https://www.mediawiki.org/wiki/Manual:$wgGrantPermissions [2] https://www.mediawiki.org/wiki/OAuth/Owner-only_consumers _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Dnia 06.09.2016 Gergo Tisza gtisza@wikimedia.org napisał/a:
On Mon, Sep 5, 2016 at 8:08 PM, Bináris wikiposta@gmail.com wrote:
I found bot passwords, but they offer very limited user rights.
They offer rights for anything which is defined in $wgGrantPermissions [1], which should be include everything a bot might need. Feel free to file a bug if that's not the case, but maybe you are just overlooking something?
So the best thing is to try without API?
Bináris, did you manage to solve it?
I am using "compat" all the time and I have no login issues.
Just tried with a fresh clone, empty "login-data" and no user-config.py and "python login.py" worked just fine.
Saper
2016-09-17 19:58 GMT+02:00 Marcin Cieslak saper@saper.info:
Bináris, did you manage to solve it?
I am using "compat" all the time and I have no login issues.
Just tried with a fresh clone, empty "login-data" and no user-config.py and "python login.py" worked just fine.
Sounds interesting, because a lot of people have complained. I will try it! As a matter of fact, my bot fortunately still works, as bot passwords do not expire, I just couldn't login with my adnib account. I will try it with a new install, I don't risk my bot. :-) So perhaps one should first login with login.py, and THEN create user-config.py?
2016-09-17 20:36 GMT+02:00 Bináris wikiposta@gmail.com:
I just couldn't login with my adnib account
admin, of course.
wikitech-l@lists.wikimedia.org