# -*- coding: utf-8 -*-

import tweepy

class Twitter(object):
    """
    Wraps Twitter stuff to get the list of friends
    """

    def __init__(self, consumer_key=None, consumer_secret=None, access_token=None, access_token_secret=None):
        auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
        auth.set_access_token(access_token, access_token_secret)
        self.api = tweepy.API(auth)

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        return True

    def getList(self):
        friends = []
        for friend in tweepy.Cursor(self.api.friends).items():
            friends.append(friend.screen_name)
        return friends
