Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Twitter library: which one? [closed]

Tags:

python

twitter

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.

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 by Konpaku Kogasa. Combines python-twitter and oauth-python-twitter to create an evolved OAuth Pokemon.
  • python-twitter by DeWitt Clinton. This library provides a pure Python interface for the Twitter API.
  • python-twyt by Andrew Price. BSD licensed Twitter API interface library and command line client.
  • twitty-twister by Dustin Sallings. A Twisted interface to Twitter.
  • twython by Ryan McGrath. REST and Search library inspired by python-twitter.
  • Tweepy by Josh Roesslein. Supports OAuth, Search API, Streaming API.

My requirements are fairly simple:

  • Be able to use OAuth
  • Be able to follow a user
  • Be able to send a direct message
  • Be able to post
  • Streaming API would be nice

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?

[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.

like image 676
Parand Avatar asked Aug 26 '10 16:08

Parand


People also ask

What Python package is best for getting data from Twitter?

Practically, if the only thing that you are looking to do is collect a large number of tweets, Twint is probably a better tool, whereas Tweepy is better suited for collecting a richer set of metadata, allows for flexibility and potentially scalability as well for those using the official API.

Is a Python library for accessing the Twitter API Tweepy?

Tweepy is an open-sourced, easy-to-use Python library for accessing the Twitter API. It gives you an interface to access the API from your Python application. Alternatively, you can also install it from the GitHub repository.

What is Twitter API library in Python?

This library provides a pure Python interface for the Twitter API. It works with Python 2.7+ and Python 3. Twitter provides a service that allows people to connect via the web, IM, and SMS. Twitter exposes a web services API and this library is intended to make it even easier for Python programmers to use.

What is Python-Twitter developers?

Author: The Python-Twitter Developers < python-twitter @ googlegroups. com > This library provides a pure Python interface for the Twitter API. It works with Python 2.7+ and Python 3. Twitter provides a service that allows people to connect via the web, IM, and SMS.

What is the best Twitter library out there?

I believe that twython (http://github.com/ryanmcgrath/twython) is the most full-featured and updated Twitter library out there. What are the best frameworks/libraries for someone learning Python?

Should I use Twitter-Python or twython?

As the other users have noted though, Twitter-Python doesn't have a streaming API (as far as I know), so if you need that use tweepy. Depends on what exactly you want to do. Twython is good and is regularly updated as well. Besides that, Python Tweeter should take care of most of the stuff you would want to achieve. Plus, it's easy and fun to use.


2 Answers

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.

EDIT: 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.

like image 116
GobiasKoffi Avatar answered Sep 21 '22 22:09

GobiasKoffi


Full disclosure: I'm the author of Twython.

As such, I'd recommend using mine. It supports OAuth now, and ships with a skeleton Django application to get you up and running in ~5 minutes.

It can handle everything you're looking for, sans the Streaming API - I'm of the opinion that something like that should be implemented on a case-by-case basis, as it's generally a fairly custom setup. There's been very little demand for library support for it, either, so I've a hard time dedicating cycles to supporting it.

pip install twython 

http://github.com/ryanmcgrath/twython

like image 21
Ryan McGrath Avatar answered Sep 18 '22 22:09

Ryan McGrath