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


Python API.haveCredentials方法代码示例

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


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

示例1: doLogin

# 需要导入模块: import API [as 别名]
# 或者: from API import haveCredentials [as 别名]
 def doLogin(self):
     try:
         if ice.haveCredentials():
             ice.Logout().delete()
     except:
         # Failure to logout is not a show-stopper
         pass
     try:
         self.loginCmd()
         self.success = True
         self["instructions"].setText(_("Congratulations, you have successfully configured your %s %s "
                                        "for use with the IceTV Smart Recording service. "
                                        "Your IceTV guide will now download in the background.") % (getMachineBrand(), getMachineName()))
         self["message"].setText(_("Enjoy how IceTV can enhance your TV viewing experience by "
                                   "downloading the IceTV app to your smartphone or tablet. "
                                   "The IceTV app is available free from the iTunes App Store, "
                                   "the Google Play Store and the Windows Phone Store.\n\n"
                                   "Download it today!"))
         self["qrcode"].show()
         config.plugins.icetv.configured.value = True
         enableIceTV()
         fetcher.createFetchJob()
     except (IOError, RuntimeError) as ex:
         msg = "Login failure: " + str(ex)
         if hasattr(ex, "response") and hasattr(ex.response, "text"):
             msg += "\n%s" % str(ex.response.text).strip()
         fetcher.addLog(msg)
         self["instructions"].setText(_("There was an error while trying to login."))
         self["message"].hide()
         self["error"].show()
         self["error"].setText(msg)
开发者ID:timoRo,项目名称:easy-gui,代码行数:33,代码来源:plugin.py

示例2: doWork

# 需要导入模块: import API [as 别名]
# 或者: from API import haveCredentials [as 别名]
 def doWork(self):
     global password_requested
     self.addLog("Start update")
     if password_requested:
         self.addLog("Can not proceed - you need to login first")
         return False
     if not ice.haveCredentials():
         password_requested = True
         self.addLog("No token, requesting password...")
         _session.open(IceTVNeedPassword)
         if not ice.haveCredentials():
             return False
     res = True
     try:
         self.channel_service_map = self.makeChanServMap(self.getChannels())
     except (IOError, RuntimeError, KeyError) as ex:
         msg = "Can not retrieve channel map: " + str(ex)
         if hasattr(ex, "response") and hasattr(ex.response, "text"):
             msg += "\n%s" % str(ex.response.text).strip()
         self.addLog(msg)
         return False
     try:
         shows = self.getShows()
         channel_show_map = self.makeChanShowMap(shows["shows"])
         epgcache = eEPGCache.getInstance()
         for channel_id in channel_show_map.keys():
             if channel_id in self.channel_service_map:
                 epgcache.importEvents(self.channel_service_map[channel_id], channel_show_map[channel_id])
         epgcache.save()
         if "last_update_time" in shows:
             config.plugins.icetv.last_update_time.value = shows["last_update_time"]
         self.addLog("EPG download OK")
         if "timers" in shows:
             res = self.processTimers(shows["timers"])
         self.addLog("End update")
         return res
     except (IOError, RuntimeError) as ex:
         if hasattr(ex, "response") and ex.response.status_code == 404:
             # Ignore 404s when there are no EPG updates - buggy server
             self.addLog("No EPG updates")
         else:
             msg = "Can not download EPG: " + str(ex)
             if hasattr(ex, "response") and hasattr(ex.response, "text"):
                 msg += "\n%s" % str(ex.response.text).strip()
             self.addLog(msg)
             res = False
     try:
         ice_timers = self.getTimers()
         if not self.processTimers(ice_timers):
             res = False
         self.addLog("End update")
     except (IOError, RuntimeError) as ex:
         msg = "Can not download timers: " + str(ex)
         if hasattr(ex, "response") and hasattr(ex.response, "text"):
             msg += "\n%s" % str(ex.response.text).strip()
         self.addLog(msg)
         res = False
     if not ice.haveCredentials() and not password_requested:
         password_requested = True
         self.addLog("No token, requesting password...")
         _session.open(IceTVNeedPassword)
     return res
开发者ID:timoRo,项目名称:easy-gui,代码行数:64,代码来源:plugin.py


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