def _login(self, callback=None):
self.debug("")
if self._callScreen:
self._callScreen.updateStatus(_("login"))
if self._md5LoginTimestamp and ((time.time() - self._md5LoginTimestamp) < float(9.5 * 60)) and self._md5Sid != '0000000000000000': # new login after 9.5 minutes inactivity
self.debug("[FritzCallFBF] renew timestamp: " + time.ctime(self._md5LoginTimestamp) + " time: " + time.ctime())
self._md5LoginTimestamp = time.time()
callback(None)
else:
self.debug("not logged in or outdated login")
# http://fritz.box/cgi-bin/webcm?getpage=../html/login_sid.xml
parms = urlencode({'getpage': '../html/login_sid.xml'})
url = "http://%s/cgi-bin/webcm" % (config.plugins.FritzCall.hostname.value)
self.debug("'" + url + "' parms: '" + parms + "'")
getPage(url,
method="POST",
headers={'Content-Type': "application/x-www-form-urlencoded", 'Content-Length': str(len(parms))},
postdata=parms).addCallback(lambda x: self._md5Login(callback, x)).addErrback(lambda x: self._oldLogin(callback, x))
评论列表
文章目录