You are printing isinstance which checks the type and returns True
or False
. If you need object you need to print x:
something like:
if(isinstance(x, tweepy.models.Relationship)):
print x
Pergunta
I am looking a way to find out relationship between twitter users via tweepy
I am using lookup_friendships()
to determine relationship but it always gives true. Here is my code:
import tweepy, time
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
user = api.get_user("LeCorrector");
rel = api.lookup_friendships(screen_names=user.screen_name)
for x in rel:
print(isinstance(x, tweepy.models.Relationship))
lookup_friendships
returns a list of tweepy.models.Relationship objects
and when I print them I always get true.
My tweepy version is 2.1. I couldn't find any documentation for this function so I'm not sure that I'm using it right. Could anybody help me with this?
Solução
You are printing isinstance which checks the type and returns True
or False
. If you need object you need to print x:
something like:
if(isinstance(x, tweepy.models.Relationship)):
print x