To use pywikibot with a farm of wikis i try to set the login password via software. I am getting the password from an encrypted source.
The line
config2.authenticate[self.netloc] = (self.user,self.getPassword())
didn't seem to have any effect in my adapter code so i started debugging the login process. It looks like LoginManager has a password field which is not used in site.php:
class LoginManager(object): """Site login manager.""" @deprecated_args(username='user', verbose=None) def __init__(self, password=None, sysop=False, site=None, user=None):
login_manager = api.LoginManager( site=self, sysop=sysop, user=self._username[sysop])
The login function in LoginManager does not have a password parameter at all. The current code structure makes it really awkward to supply a password via software.
if not self.password: # First check that the username exists, # to avoid asking for a password that will not work. if not autocreate: self.check_user_exists() # As we don't want the password to appear on the screen, we set # password = True self.password = pywikibot.input(
It would be great if the logic would be changed to making a password available via api would be made simpler e.g. by having password=None as an optional parameter for login.