本文整理汇总了Python中logbook.FileHandler.threadbound方法的典型用法代码示例。如果您正苦于以下问题:Python FileHandler.threadbound方法的具体用法?Python FileHandler.threadbound怎么用?Python FileHandler.threadbound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logbook.FileHandler
的用法示例。
在下文中一共展示了FileHandler.threadbound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Application
# 需要导入模块: from logbook import FileHandler [as 别名]
# 或者: from logbook.FileHandler import threadbound [as 别名]
class Application(object):
"""a base class for dispatching WSGI requests"""
def __init__(self, settings={}, prefix=""):
"""initialize the Application with a settings dictionary and an optional
``prefix`` if this is a sub application"""
self.settings = settings
self.mapper = routes.Mapper()
self.setup_handlers(self.mapper)
self.loghandler = FileHandler(self.logfilename)
def __call__(self, environ, start_response):
with self.loghandler.threadbound():
request = werkzeug.Request(environ)
m = self.mapper.match(environ = environ)
if m is not None:
handler = m['handler'](app=self, request=request, settings=self.settings)
try:
return handler.handle(**m)(environ, start_response)
except werkzeug.exceptions.HTTPException, e:
return e(environ, start_response)
# no view found => 404
return werkzeug.exceptions.NotFound()(environ, start_response)
示例2: print
# 需要导入模块: from logbook import FileHandler [as 别名]
# 或者: from logbook.FileHandler import threadbound [as 别名]
password=password
)
print("logged in successfully as: %" % client.get('/me').username)
track = client.post('/tracks', track={
'title': 'Harmonic Mix %s' % mixfilename,
'sharing': 'private',
'description': 'Someone should add the song names in the mix here',
'asset_data': open(mixfilename, 'rb')
})
print("uploaded your mix as: %s", track.title)
class extenddict(dict):
def __setitem__(self, key, value):
"""add the given value to the list of values for this key"""
self.setdefault(key, []).append(value)
with file_handler.threadbound():
newest = mixmaster(120)
#soundcloudupload(newest)