'Private method.
Logs in user and gets authkey from server.'

def _login(self):

    if self.logged_in():
        return
    self.wait_for_rate_limit()
    loginpage = (self.site + 'login.php')
    data = {'username': self.username, 'password': self.password, 'keeplogged': '1'}
    r = self.session.post(loginpage, data=data, timeout=self.default_timeout, headers=self.default_headers)
    self.past_request_timestamps.append(time.time())
    if (r.status_code != 200):
        raise LoginException(('Login    returned    status    code    %s' % r.status_code))
    try:
        accountinfo = self.request('index', autologin=False)
    except RequestException as e:
        raise LoginException('Login    probably    incorrect')
    if ((not accountinfo) or ('id' not in accountinfo)):
        raise LoginException('Login    probably    incorrect')
    self.userid = accountinfo['id']
    self.authkey = accountinfo['authkey']
    self.passkey = accountinfo['passkey']
    self.logged_in_user = User(self.userid, self)
    self.logged_in_user.set_index_data(accountinfo)
