FritzCallFBF.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:enigma2-plugins 作者: opendreambox 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号