def save_status(act, status_list): for status in status_list: if not TwStatus.objects.filter(pk=status['id']): new_status = TwStatus() new_status.id = status['id'] new_status.twAccount = act new_status.text = status['text'] new_status.created_at = status['created_at'] new_status.save()
def update_twitter_status(self, twaccount, status_list): for json_status in status_list: status = TwStatus() status.id = json_status['id_str'] status.twAccount = twaccount status.text = json_status['text'] transfer_ts = time.strftime('%Y-%m-%d %H:%M:%S', time.strptime(json_status['created_at'], '%a %b %d %H:%M:%S +0000 %Y')) status.created_at = transfer_ts status.save()
def update_twitter_status(self, twaccount, status_list): for json_status in status_list: status = TwStatus() status.id = json_status["id_str"] status.twAccount = twaccount status.text = json_status["text"] transfer_ts = time.strftime( "%Y-%m-%d %H:%M:%S", time.strptime(json_status["created_at"], "%a %b %d %H:%M:%S +0000 %Y") ) status.created_at = transfer_ts status.save()