当前位置: 首页>>代码示例>>Python>>正文


Python LoggingException.addLogMessage方法代码示例

本文整理汇总了Python中loggingexception.LoggingException.addLogMessage方法的典型用法代码示例。如果您正苦于以下问题:Python LoggingException.addLogMessage方法的具体用法?Python LoggingException.addLogMessage怎么用?Python LoggingException.addLogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在loggingexception.LoggingException的用法示例。


在下文中一共展示了LoggingException.addLogMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Login

# 需要导入模块: from loggingexception import LoggingException [as 别名]
# 或者: from loggingexception.LoggingException import addLogMessage [as 别名]
    def Login(self):
        self.log(u"", xbmc.LOGDEBUG)
        """
        {
            'epg': 'WEB_STD',
            'user': {
                'decay': 40,
                'email': 'email',
                'fname': 'fname',
                'id': '87354',
                'ipicid': 'aertv530916c892b25',
                'is_paid_subscriber': 0/1,
                'lname': 'lname',
                'login': True,
                'mailchimp': None,
                'packages': [
                    {
                        'code': 'WEB_STD',
                        'desc': 'Free Channel Pack',
                        'package_id': '1'
                    },
                    {
                        "code":"AERTV_PLUS",
                        "desc":"Aertv Plus",
                        "package_id":"6"
                    }                    
                ],
                'session': 'YWVydHY1MzA5MTZjODkyYjI0_1393452432',
                'status': '1',
                'val_code': None
            }
        }
        """
        
        loginJSON = None
        
        email = self.addon.getSetting( u'AerTV_email' ).decode(u'utf8')
        password = self.addon.getSetting( u'AerTV_password' ).decode(u'utf8')
        
        if len(email) == 0 or len(password) == 0:
            if not xbmcvfs.exists(self.aertvNoticeFilePath):
                file = open(self.aertvNoticeFilePath, u'w')
                try:
                    file.write(" ")
                finally:
                    file.close()
                    
                dialog = xbmcgui.Dialog()
                dialog.ok(self.language(30105), self.language(30106))
                
                self.addon.openSettings(sys.argv[ 0 ])
                
                email = self.addon.getSetting( u'AerTV_email' ).decode(u'utf8')
                password = self.addon.getSetting( u'AerTV_password' ).decode(u'utf8')
                
            if len(email) == 0 or len(password) == 0:
                self.log(u"No AerTV login details", xbmc.LOGDEBUG)
                return False

        try:
            loginJSON = self.LoginViaCookie()
        except (Exception) as exception:
            if not isinstance(exception, LoggingException):
                exception = LoggingException.fromException(exception)

            # 'AerTV login failed', 
            exception.addLogMessage(self.language(30101))
            exception.process(severity = self.logLevel(xbmc.LOGWARNING))
        
                
        if loginJSON is None:
            try:
                values = [{u'api':u'login'},{u'user':email},{u'pass':password}]
                loginJSON = self.AttemptLogin(values, logUrl = False)

                self.log(u"After weblogin loginJSON is None: " + unicode(loginJSON is None), xbmc.LOGDEBUG)
                
                if loginJSON is None:
                    # 'AerTV login failed', 
                    exception = LoggingException(self.language(30101))
                    # "Status Message: %s
                    exception.process(severity = self.logLevel(xbmc.LOGERROR))
                    return False
                
                self.log(u"Login successful", xbmc.LOGDEBUG)
                
                sessionId = loginJSON[u'user'][u'session']
                
                days02 = 2*24*60*60
                expiry = int(time.time()) + days02
                    
                self.log(u"Aertv_login expiry: " + unicode(expiry), xbmc.LOGDEBUG)
                
                sessionCookie = self.MakeCookie(u'Aertv_login', sessionId, domain, expiry )
                self.cookiejar.set_cookie(sessionCookie)
                self.cookiejar.save()

                loginJSON = self.LoginViaCookie()
                
            except (Exception) as exception:
#.........这里部分代码省略.........
开发者ID:Lusephur,项目名称:plugin-video-irishtv,代码行数:103,代码来源:aertv.py


注:本文中的loggingexception.LoggingException.addLogMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。