def get_new_breakdowns():
""" Return Breakdown Notifications and Refresh DB"""
db = dataset.connect(database_url)
new_breakdown = all_breakdowns()
table = db['train']
""" Get New Breakdowns"""
new = []
for key, value in new_breakdown.items():
if table.find_one(tweet_id=key) is None:
new.append(key)
else:
pass
""" Add to DB """
for key in new:
table.insert(dict(tweet_id=key,
tweet=new_breakdown[key]['tweet'],
created_at=new_breakdown[key]['created_at']))
return new
评论列表
文章目录