code: def login(self, username=None, password=None, **kwargs):
          
          if password and not username:
              raise Exception('Username must be provided when password is.')
          user = username or self.config.user
          if not user:
              sys.stdout.write('Username: ')
              sys.stdout.flush()
              user = sys.stdin.readline().strip()
              pswd = None
          else:
              pswd = password or self.config.pswd
          if not pswd:
              import getpass
              pswd = getpass.getpass('Password for {0}: '.format(user)
                                     .encode('ascii', 'ignore'))
  
          data = {'passwd': pswd,
                  'user': user}
          self.clear_authentication()
          self.request_json(self.config['login'], data=data)
          # Update authentication settings
          self._authentication = True
          self.user = self.get_redditor(user)
          self.user.__class__ = objects.LoggedInRedditor
docs: Login to a reddit site.
  
          **DEPRECATED**. Will be removed in a future version of PRAW.
  
          https://www.reddit.com/comments/2ujhkr/
          https://www.reddit.com/comments/37e2mv/
  
          Look for username first in parameter, then praw.ini and finally if both
          were empty get it from stdin. Look for password in parameter, then
          praw.ini (but only if username matches that in praw.ini) and finally
          if they both are empty get it with getpass. Add the variables ``user``
          (username) and ``pswd`` (password) to your praw.ini file to allow for
          auto-login.
  
          A successful login will overwrite any existing authentication.