Ejemplo n.º 1
0
def tweets(id = None):
	if id == None:
		id = current_user.id

	# random tweets
	random_tweets = twitter.random_tweets(NUM_RAND_TWEETS_TO_PULL)
	add_section(random_tweets, "random")

	# last tweets
	last_five_tweets = current_user.get_last_five_tweets()
	add_section(last_five_tweets, "last")

	# save new last tweets
	save_last_five_tweets(random_tweets)

	# followed liked tweets
	liked_tweets = current_user.get_followed_liked_tweets(MAX_TWEETS - len(random_tweets) - len(last_five_tweets))
	add_section(liked_tweets, "liked")

	# combine and add likes attribute
	all_tweets = (random_tweets + last_five_tweets + liked_tweets)
	add_likes(all_tweets)

	return json.dumps(all_tweets)
Ejemplo n.º 2
0
def last_tweets():
	return json.dumps(current_user.get_last_five_tweets())