

def login(self):
    '\n        Try to login and set the internal session id.\n\n        Please note:\n        - Any failed login resets all existing session ids, even of\n          other users.\n        - SIDs expire after some time\n        '
    response = self.session.get((self.base_url + '/login_sid.lua'))
    xml = ET.fromstring(response.text)
    if (xml.find('SID').text == '0000000000000000'):
        challenge = xml.find('Challenge').text
        url = (self.base_url + '/login_sid.lua')
        response = self.session.get(url, params={
            'username': self.username,
            'response': self.calculate_response(challenge, self.password),
        })
        xml = ET.fromstring(response.text)
        sid = xml.find('SID').text
        if (xml.find('SID').text == '0000000000000000'):
            blocktime = int(xml.find('BlockTime').text)
            exc = Exception('Login failed, please wait {} seconds'.format(blocktime))
            exc.blocktime = blocktime
            raise exc
        self.sid = xml
        return sid

dataset/ETHPy150Open DerMitch/fritzbox-smarthome/fritzhome/fritz.py FritzBox.login/VarMisuse@193/327 `sid`->`xml`