def processExistingUser(api, dynamo): user = api.me() rowUser = dynamo.getUser(user.id) print "user fetched from db" interests_dict = rowUser["interests"] userInterests = UserInterests(api, interests_dict) response = userInterests.generateNewInterests(rowUser["last_tweet_id"]) if response[0]: print "update dynamo" last_tweet_id = response[1] interests = userInterests.getInterests() dynamo.updateInterests(rowUser['user_id'], last_tweet_id, interests) else: print 'No new updates' return userInterests.getInterests()