本文整理汇总了Python中core.logger.Logger.warn方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.warn方法的具体用法?Python Logger.warn怎么用?Python Logger.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.logger.Logger
的用法示例。
在下文中一共展示了Logger.warn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: bool
# 需要导入模块: from core.logger import Logger [as 别名]
# 或者: from core.logger.Logger import warn [as 别名]
# TODO actually test trakt.tv authentication
success = bool(Dict['trakt.token'])
if not success:
# status - False = invalid credentials, None = request failed
if retry:
# Increase retry interval each time to a maximum of 30 minutes
if retry_interval < 60 * 30:
retry_interval = int(retry_interval * 1.3)
# Ensure we never go over 30 minutes
if retry_interval > 60 * 30:
retry_interval = 60 * 30
log.warn('Unable to authentication with trakt.tv, will try again in %s seconds', retry_interval)
schedule(cls.authenticate, retry_interval, retry_interval)
else:
log.warn('Authentication failed, username or password is incorrect')
Main.update_config(False)
return False
log.info('Authentication successful')
Main.update_config(True)
return True
def start(self):
# Check for authentication token
log.info('X-Plex-Token: %s', 'available' if os.environ.get('PLEXTOKEN') else 'unavailable')
示例2: should_retry
# 需要导入模块: from core.logger import Logger [as 别名]
# 或者: from core.logger.Logger import warn [as 别名]
data = urllib2.urlopen(req, **kwargs).read()
if cache_id is not None:
cache.update((req.get_full_url(), cache_id), data)
return Response.from_data(response_type, data)
except RequestError, e:
ex = e
except Exception, e:
ex = NetworkError.from_exception(e, response_type=response_type)
if raise_exceptions:
raise ex
else:
log.warn('Network request raised exception: %s' % ex)
return default
def should_retry(error_code):
# If there is no error code, assume we should retry
if error_code is None:
return True
for retry_code in HTTP_RETRY_CODES:
if type(retry_code) is tuple and len(retry_code) == 2:
if retry_code[0] <= error_code <= retry_code[1]:
return True
elif type(retry_code) is int:
if retry_code == error_code: