Search code examples
python-2.7twittertweepy

Tweepy Twitter API command results


I'm using tweepy to data mine stuff on twitter and while using the commands of the API the results look pretty weird. Should the results be like this when I use this code?

This is my code

import oauth, tweepy
import csv

list_user = []
list_user_follower = []
number = 0

with open('tweets.csv', 'rb') as user:
    reader = csv.reader(user, delimiter=",")
    for i in reader:
        list_user.insert(number, i[0])
        number += 1

def init():
    global api
    consumer_key = "...."
    consumer_secret = "...."
    access_key = "...."
    access_secret = "...."
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_key, access_secret)
    api = tweepy.API(auth)

    print api.followers(list_users[0])

init()

This is the result. Take note that this isn't the full results since it was too long to put here.

[User(follow_request_sent=False, has_extended_profile=False, profile_use_background_image=True, profile_sidebar_fill_color=u'DDEEF6'

Any help would be appreciated thank you.


Solution

  • Yes, that looks correct - your API request is returning the first entry in a list of users. The Tweepy documentation clearly states that the return value from this call is a list of User objects. You're printing that straight to the console. The values contained in a User object are documented in Twitter's API documentation.