本文整理汇总了Python中snsapi.snslog.SNSLog.info方法的典型用法代码示例。如果您正苦于以下问题:Python SNSLog.info方法的具体用法?Python SNSLog.info怎么用?Python SNSLog.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snsapi.snslog.SNSLog
的用法示例。
在下文中一共展示了SNSLog.info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: input
# 需要导入模块: from snsapi.snslog import SNSLog [as 别名]
# 或者: from snsapi.snslog.SNSLog import info [as 别名]
def input(self, ml):
count = 0
for m in ml:
if self._inqueue(m):
count += 1
logger.info("Input %d new message", count)
self.log("Input %d new message" % count)
示例2: load_weight
# 需要导入模块: from snsapi.snslog import SNSLog [as 别名]
# 或者: from snsapi.snslog.SNSLog import info [as 别名]
def load_weight(self, fn = None):
if fn is None:
fn = 'conf/weights.json'
try:
self.feature_weight = json.loads(open(fn, 'r').read())
self.feature_name = self.feature_weight.keys()
logger.info("Loaded weights: %s", self.feature_weight)
except IOError:
logger.warning("No '%s' weights config file, use empty setting.", fn)
self.feature_weight = {}
self.feature_name = self.feature_weight.keys()
示例3: input
# 需要导入模块: from snsapi.snslog import SNSLog [as 别名]
# 或者: from snsapi.snslog.SNSLog import info [as 别名]
def input(self, channel = None):
if channel:
ml = self._home_timeline(channel)
else:
ml = snstype.MessageList()
for chn in self.sp:
ml.extend(self._home_timeline(chn))
count = 0
for m in ml:
if self._inqueue(m):
count += 1
logger.info("Input %d new message", count)
self.log("Input %d new message" % count)
示例4: reweight_all
# 需要导入模块: from snsapi.snslog import SNSLog [as 别名]
# 或者: from snsapi.snslog.SNSLog import info [as 别名]
def reweight_all(self, younger_than = 86400):
begin = self.time()
cur = self.con.cursor()
try:
latest_time = int(self.time() - younger_than)
r = cur.execute('''
SELECT id from msg
WHERE time >= ?
''', (latest_time, ))
for m in r:
self.reweight(m[0])
except Exception, e:
logger.warning("Catch exception: %s", e)
return False
end = self.time()
logger.info("Reweight done. Time elapsed: %.2f", end - begin)
return True
def _dump2pickle(self, fn_pickle):
# dump all to pickle format
cur = self.con.cursor()
r = cur.execute('''
SELECT id,time,userid,username,text,pyobj,flag FROM msg
''')
message_list = snstype.MessageList()
for m in r:
obj = self._str2pyobj(m[5])
obj.msg_id = m[0]
obj.flag = m[6]
message_list.append(obj)
r = cur.execute('''
示例5: load_config
# 需要导入模块: from snsapi.snslog import SNSLog [as 别名]
# 或者: from snsapi.snslog.SNSLog import info [as 别名]
* lc = load_config
* sc = save_config
* lsc = list_channel
* lsp = list_platform
* newc = new_channel
* addc = add_channel
* clc = clear_channel
* auth = auth
* ht = home_timeline
* up = update
* re = reply
* fwd = forward
* lk = like
* ulk = unlike
Tutorial of SNSCLI:
* https://github.com/hupili/snsapi/wiki/Tutorial-of-snscli
"""
if __name__ == '__main__':
#==== default initialization one may like ====
print helpdoc
load_config()
list_channel()
auth()
logger.info("Ready to drop into the interactive shell of SNSCLI!")
import code
code.interact(local=locals())