def get_recommendation(): new_tweets = UserTweetDao.get_new_user_tweets() for tweet in new_tweets: UserTweetDao.update_status(tweet, Enums.UserTweetStatus.requested) rec_input_list = get_rec_input_from_tweet(tweet) rec = None if len(rec_input_list) > 0: rec = recommend(rec_input_list) if rec is not None: text = get_rec_text_for_tweet(tweet, rec) RecommendationDao.create_recommendation(tweet.id, rec.fullRec, text) UserTweetDao.update_status(tweet, Enums.UserTweetStatus.done) else: UserTweetDao.update_status(tweet, Enums.UserTweetStatus.no_recommendation)