【发布时间】:2012-11-04 05:48:32
【问题描述】:
我正在编写一个简单的Tweepy 应用程序来娱乐,但我真的受限于我有多少 API 调用(介于 150 到 350 之间)。因此,为了解决这个问题,我正在寻找减少通话的方法。 Tweepy 有一个内置的光标系统。例如:
# Iterate through all of the authenticated user's friends
for follower in tweepy.Cursor(api.followers).items():
follower.follow()
对于那些熟悉这个库的人。上面的例子会比简单的效率更高还是更低......
for follower in api.followers_ids():
api.follow(follower)
除了使用 Cursor 方法比迭代方法简单之外,还有其他优点吗?
提前致谢。
【问题讨论】: