def _get_auth_tokens(self):
        """Retrieve auth tokens from the router."""
        _LOGGER.info("Retrieving auth tokens...")

        url = 'http://{}/cgi-bin/luci/;stok=/login?form=login' \
            .format(self.host)
        referer = 'http://{}/webpages/login.html'.format(self.host)

        # If possible implement rsa encryption of password here.
        response = requests.post(url,
                                 params={'operation': 'login',
                                         'username': self.username,
                                         'password': self.password},
                                 headers={'referer': referer})

        try:
            self.stok = response.json().get('data').get('stok')
            _LOGGER.info(self.stok)
            regex_result = re.search('sysauth=(.*);',
                                     response.headers['set-cookie'])
            self.sysauth = regex_result.group(1)
            _LOGGER.info(self.sysauth)
            return True
        except __HOLE__:
            _LOGGER.error("Couldn't fetch auth tokens!")
            return False
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/device_tracker/tplink.py/Tplink3DeviceScanner._get_auth_tokens