Ejemplo n.º 1
0
    def timeline(self, limit = 0):
        if not self._api:
            return None

        notes = []

        for tweet in tweepy.Cursor(self._api.home_timeline).items(limit):
            author = User(tweet.user.screen_name,
                          tweet.user.name.encode('utf-8'),
                          tweet.user.description.encode('utf-8'),
                          tweet.user.location.encode('utf-8'),
                          tweet.user.friends_count,
                          tweet.user.followers_count,
                          tweet.user.statuses_count,
                          tweet.user.favourites_count)

            note = Note(tweet.id_str, author, tweet.created_at, tweet.text.encode('utf-8'))

            note.replyto = self.user(tweet.in_reply_to_screen_name)
            note.source = tweet.source.encode('utf-8')
            note.shares = tweet.retweet_count
            note.likes = tweet.favorite_count

            notes.append(note)

        return notes
Ejemplo n.º 2
0
    def userTimeline(self, id, limit = 0):
        if not self._api or not id:
            return None

        res = self._api.user_timeline(screen_name = id, count = limit)

        if not res:
            return None

        notes = []

        for tweet in res:
            author = User(tweet.user.screen_name,
                          tweet.user.name.encode('utf-8'),
                          tweet.user.description.encode('utf-8'),
                          tweet.user.location.encode('utf-8'),
                          tweet.user.friends_count,
                          tweet.user.followers_count,
                          tweet.user.statuses_count,
                          tweet.user.favourites_count)

            note = Note(tweet.id_str, author, tweet.created_at, tweet.text.encode('utf-8'))

            note.replyto = self.user(tweet.in_reply_to_screen_name)
            note.source = tweet.source.encode('utf-8')
            note.shares = tweet.retweet_count
            note.likes = tweet.favorite_count

            notes.append(note)

        return notes