當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。