Tweepy 是否支持运行多个 Streams 来收集数据? [英] Does Tweepy support running multiple Streams to collect data?

查看:31
本文介绍了Tweepy 是否支持运行多个 Streams 来收集数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我想收集与三个关键字相关的数据:

For example, I'd like to collect data related to three keywords:

  1. 关键字1
  2. keyword2
  3. keyword3

我知道我可以使用:set track=[keyword1,keyword2,keyword3] 一次性收集所有这些信息.是否可以运行三个不同的 Python 进程来分别收集这些关键字的数据?

I understand that I could collect them all at one time using: set track=[keyword1,keyword2,keyword3]. Is it possible to run three different Python processes to collect data for those keywords separately?

推荐答案

不幸的是,.假设您正在使用 Tweepy 的 Stream 类(它使用 Twitter Streaming API),您不能与单个帐户建立多个连接.如果您尝试使用多个帐户来规避这一点,您还应该注意:

Unfortunately, no. Assuming you're using Tweepy's Stream class (which uses the Twitter Streaming API) you can not make multiple connections with a single account. You should also watch out if you try to circumvent this using multiple accounts:

每个帐户只能创建一个与公共端点的常设连接,并且使用相同的帐户凭据多次连接到公共流将导致最旧的连接断开.

Each account may create only one standing connection to the public endpoints, and connecting to a public stream more than once with the same account credentials will cause the oldest connection to be disconnected.

进行过多连接尝试(成功和不成功)的客户端会面临 IP 被自动禁止的风险.

Clients which make excessive connection attempts (both successful and unsuccessful) run the risk of having their IP automatically banned.

-Twitter 流 API

这篇关于Tweepy 是否支持运行多个 Streams 来收集数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆