Python Twitter 库:哪个? [英] Python Twitter library: which one?
问题描述
我意识到这是一个懒惰的网络问题,但我想看看人们对 Twitter 的哪个 Python 库有很好的体验.
I realize this is a bit of a lazyweb question, but I wanted to see which python library for Twitter people have had good experiences with.
我使用过 Python Twitter 工具 并喜欢它的简洁和美观的界面,但它没有似乎不是最受欢迎的之一 - 它甚至没有列在 Twitter 图书馆页面.
I've used Python Twitter Tools and like its brevity and beauty of interface, but it doesn't seem to be one of the popular ones - it's not even listed on the Twitter Libraries page.
然而,列出了很多其他的:
There are, however, plenty of others listed:
- oauth-python-twitter2 由 Konpaku Kogasa 提供.结合 python-twitter 和 oauth-python-twitter 来创建一个进化的 OAuth Pokemon.
- 德威特克林顿的 python-twitter.该库为 Twitter API 提供了一个纯 Python 接口.
- python-twyt 由 Andrew Price 编写.BSD 许可 Twitter API 接口库和命令行客户端.
- Dustin Sallings 的 twitty-twister.Twitter 的扭曲界面.
- 瑞恩·麦格拉思 (Ryan McGrath) 的 twython.受 python-twitter 启发的 REST 和搜索库.
- Josh Roesslein 的 Tweepy.支持 OAuth、搜索 API、流 API.
我的要求相当简单:
- 能够使用 OAuth
- 能够关注用户
- 能够直接发送消息
- 可以发帖
- 流式 API 会很好
将一个放在一边(在这种情况下我没有使用扭曲),您是否使用过其他任何一种,如果使用过,您是否推荐它们?
Twisted one aside (I'm not using twisted in this case), have you used any of the others, and if so, do you recommend them?
[更新] FWIW,我最终再次使用 Python Twitter 工具.新版本很好地支持了 OAuth,它是一个非常聪明的 API,所以我坚持使用它.
[Update] FWIW, I ended up going with Python Twitter Tools again. The new version supported OAuth nicely, and it's a very clever API, so I stuck to it.
推荐答案
python-twitter
应该涵盖前四个要求.我以前用过它,用它开始开发相当容易.为了利用 Twitter 的流 API,我推荐 tweetstream
.这是一个很棒的 Python 模块,可以在推文发布时实时抓取它们.根据您是否可以访问 twitter 流,您只会收到一小部分推文.使用 tweetstream,您还可以提供搜索谓词列表来过滤您正在查找的特定推文.我将它用于一个涉及在 8 小时内挖掘推文的项目,并且它完美地工作.这两个模块都应该可以通过 Python 的 easy-install
获得.
python-twitter
should cover the first four requirements. I've used it before, and it's fairly easy to start developing with it. For leveraging Twitter's streaming API, I would recommend tweetstream
. It's a fantastic Python module that grabs tweets in real-time as they are posted. Based on whether you have gardenhose/firehose access to the twitter stream, you'll only get a small fraction of tweets posted. With tweetstream, you can also provide a list of search predicates to filter specific tweets that you are looking for. I used it for a project that involved mining tweets over an 8 hour period and it worked flawlessly. Both of these modules should be available through Python's easy-install
.
我不知道您打算用 Python/Twitter 做什么,但如果您确实计划捕获大量推文,请记住,Twitter 会收到除英语之外的其他语言的无数推文.请记住正确编码所有内容.
I don't know what you intend on doing with Python/Twitter but if you do plan on capturing a lot of tweets, keep in mind that Twitter receives myriad tweets in languages besides English. Remember to encode everything properly.
这篇关于Python Twitter 库:哪个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!