jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/699275 )
Change subject: Make new api.LoginManager.parameters private ......................................................................
Make new api.LoginManager.parameters private
- Renamed to api.LoginManager._login_parameters - Require named arguments - Also fix typing
Follow-Up: Ib7c24513fb08c475dcebe28ebd6b0411b2822372
Change-Id: I6f94f16c5e146a70c56040d7401aebd07927498f --- M pywikibot/data/api.py 1 file changed, 6 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 5bbaf38..305c5c1 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -25,7 +25,7 @@
import pywikibot from pywikibot import config, login -from pywikibot.backports import Tuple, removeprefix +from pywikibot.backports import Dict, Tuple, removeprefix from pywikibot.comms import http from pywikibot.exceptions import ( Error, @@ -2848,7 +2848,8 @@ """Get API keyword from mapping.""" return self.mapping[key][self.action != 'login']
- def parameters(self, botpassword: bool) -> dict: + def _login_parameters(self, *, botpassword: bool = False + ) -> Dict[str, str]: """Return login parameters.""" # Since MW 1.27 only for bot passwords. self.action = 'login' @@ -2896,7 +2897,7 @@ # otherwise @ is not allowed in usernames. # @ in bot password is deprecated, # but we don't want to break bots using it. - parameters = self.parameters( + parameters = self._login_parameters( botpassword='@' in self.login_name or '@' in self.password)
# base login request @@ -2966,10 +2967,8 @@
raise pywikibot.exceptions.APIError(code=status, info=fail_reason)
- def get_login_token(self) -> str: - """Fetch login token from action=query&meta=tokens. - - Requires MediaWiki >= 1.27. + def get_login_token(self) -> Optional[str]: + """Fetch login token for MediaWiki 1.27+.
:return: login token """