我想取消关注我关注的所有人。 我的代码出了什么问题?
import tweepy
#unfollow script
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
# llölölöälöä
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
def unfollow():
print("[+] Unfollowing in progress...")
for user in api.followers():
api.destroyfriendship(user)
test = input("Type ENTER if you want to start.")
test = True
if test is True:
unfollow()
else:
print("Thanks for using my script")
AttributeError:' API'对象没有属性' destroyfriendship'
答案 0 :(得分:1)
假设您使用的是最新版本的Tweepy API,则您的方法调用中会出现拼写错误。
api.destroyfriendship(user)
正确的电话应如下:
api.destroy_friendship(user)