本文整理汇总了Python中monitor.Monitor.delKey方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.delKey方法的具体用法?Python Monitor.delKey怎么用?Python Monitor.delKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.delKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processPost
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import delKey [as 别名]
def processPost(url, token, requestQueue, name, module, isMonitor=False):
mon = None
if isMonitor: mon = Monitor()
monName = 'thread-' + name
try:
l.log('Opening connection with interface %s' % url, name, monName, 'copy-string', mon)
client = openConnection(url)
except:
l.log("Error opening connection with interface - %s" % (sys.exc_info()[1]), name, monName, 'copy-string', mon)
if isMonitor: mon.delKey(monName)
return None
while 1:
l.log('Waiting for next in the queue to arrive', name, monName, 'copy-string', mon)
post = requestQueue.get()
if post == 'kill':
l.log("I am done, ending thread", name, monName, 'copy-string', mon)
if isMonitor: mon.delKey(monName)
return None
if type(post) != type(dict()):
l.log("Feed type is wrong, expected <dict>", name, monName, 'copy-string', mon)
continue
try:
id = post['id']
blog_type = post['blog_type']
blog_version = post['blog_version']
manager_url = post['blog_manager_url']
blog_username = post['blog_username']
blog_password = post['blog_password']
entry_title = post['entry_title']
entry_content = post['entry_content']
article_link = post['article_link']
except:
l.log("Invalid post dictionary", name, monName, 'copy-string', mon)
continue
l.log("Well publish using: %s (%s) - %s:%s" % (blog_type, manager_url, blog_username, "*"*len(blog_password)), name, monName, 'copy-string', mon)
dynClass = module.myClassByName(blog_type, manager_url, blog_username, blog_password)
dynClass.setLogBanner(name)
if dynClass == None:
l.log("Blog not supported", name, monName, 'copy-string', mon)
continue
l.log("Blog is supported! My name from the dynamic class is %s" % dynClass.modName, name, monName, 'copy-string', mon)
if dynClass.authenticate() == False:
l.log("Unable to authenticate", name, monName, 'copy-string', mon)
continue
l.log("Authenticated!", name, monName, 'copy-string', mon)
l.log("Preparing to publish %s" % (id), name, monName, 'copy-string', mon)
message = ""
try:
dynClass.setArticleLink(article_link)
dynClass.setTitle(entry_title)
dynClass.setContent(entry_content)
if dynClass.postEntry() == False:
l.log("Error postEntry returned false for %s" % (id), name, monName, 'copy-string', mon)
continue
except xmlrpclib.Fault, message:
l.log("(2) Failed to publish (%s) - (%s)" % (id, sys.exc_info()[1]), name, monName, 'copy-string', mon)
except: