Tweepy with stream 挂起跟随标签

Tweepy with stream hangs for follow tag

我正在尝试 运行 Tweepy StreamListener 在 Twitter 上关注用户的推文。

当我使用 track 关键字时它有效,但是当我添加 follow='userid' 时它挂起。我做错了什么吗?

stream_listener = StreamListener()
auth = OAuthHandler("", "")
auth.set_access_token("", "")
stream = Stream(auth=auth, listener=stream_listener)
#stream.filter(follow="")
api = tweepy.API(auth)
screen_name = "ThetaWarrior"
user = api.get_user(screen_name)
api = tweepy.API(auth, wait_on_rate_limit=True)
print("User details:")
print(user.name)
print(user.description)
print(user.location)
print(user.id_str)
stream.filter(follow="98**************")

follow参数需要是用户ID列表,不能是字符串,例如:
stream.filter(follow=["98**************"])
假设 "98**************" 是一个实际的用户 ID。

参见 the Streaming with Tweepy section of the documentation for Tweepy v3.10 or the documentation for Stream.filter for the latest development version of Tweepy on the master branch, set to be released as v4.0. Also see the documentation for the POST statuses/filter endpoint