我想在应用程序中编写一小段代码来检查用户是否关注您。我只想让代码返回一个True/False值,我可以把它放在一个if循环中。从JSON Twitter响应(Tweepy和Python)中提取单个True/False值
的代码是:
user_id = '1234567890'
print api.show_friendship(target_id=user_id)
,并返回这一切的JSON,我一无所知,但想从下“下”(或者其他用户的第二阵列的“假”值,真/假,从下“followed_by”第一阵列......无论哪种方式是好的)!
{"relationship":{"source":{"id":0000000000,"id_str":"0000000000","screen_name":"auth_user","following":false,"followed_by":false,"following_received":false,"following_requested":false,"notifications_enabled":false,"can_dm":false,"blocking":false,"blocked_by":false,"muting":false,"want_retweets":false,"all_replies":false,"marked_spam":false},"target":{"id":123456789,"id_str":"123456789","screen_name":"other_user","following":false,"followed_by":false,"following_received":false,"following_requested":false}}}
我怎样才能让我的代码返回真/假的“以下”:假的一部分?
(或中,“followed_by”:第一阵列中假部分 - 每一个阵列是从用户的关系的“视点”)