[bugfix] don't try to retrieve data until logged in
[bugfix] don't try to retrieve data until logged in

mw_version Site property does an API call but this may fail
if a user is not logged in already. Therefore api.LoginManager
should not make an api call except for login purposes.

- move parameters preparation to api.LoginManager.parameters method.
- call get_login_token() to determine the mw version dispatching
- generate a fresh token if status in ('NeedToken', 'WrongToken', 'badtoken')

Bug: T284577
Change-Id: Ib7c24513fb08c475dcebe28ebd6b0411b2822372

wikimedia/pywikibot-core,wikimedia/pywikibot-core