I went to twitter's API, it redirected me to google code, and the website wasn't there. Any alternative twitter APIs, plus tutorials? thanks!
Try Tweepy: http://code.google.com/p/tweepy/
You can get to a tutorial wiki page for it at the same Google Code link.
To install it with easy_install, just run easy_install tweepy
To install it with git:
git clone git://github.com/joshthecoder/tweepy.git
cd tweepy
python setup.py install
To install it from source, download the source from http://pypi.python.org/pypi/tweepy then run something like:
tar xzvf tweepy-1.7.1.tar.gz
cd tweepy-1.7.1
python setup.py install
I've been using Python-Twitter for the past couple of months. It makes it extremely easy to pull data from the Twitter API as well as post Tweets.
You can install via pip:
pip install python-twitter
or by cloning from git => https://github.com/bear/python-twitter.git then installing the dependencies (which can be done via pip) follow the instructions in README.rt
python setup.py build
then
python setup.py install
After you've installed the library, I'd recommend setting up a simple authentication file (eg. twitterAuth.py) like this one:
# twitterAuth.py
import twitter
"""This script is meant to connect to the Twitter API via the tokens below"""
api = twitter.Api(consumer_key='yourConsumerKeyGoesHere',
consumer_secret='yourConsumerSecretGoesHere',
access_token_key='your-AccessTokenGoesHere',
access_token_secret='yourTokenSecretGoesHere')
Then you can simply import this from any scripts that need to acccess the Twitter API. Here's a simple example that posts a Tweet:
from twitter import *
import twitterAuth
api = twitterAuth.api
status = api.PostUpdate('testing twitter-python')
print status.text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With