Howto install Tweepy for python3.2 using debian Wheezy

Setuptools itself doesn’t work on Python 3.X. But you can use Distribute, a fork and a drop in replacement for setuptools in python3

curl -O http://python-distribute.org/distribute_setup.py
sudo python3.2 distribute_setup.py
sudo python3.2 setup.py install

First I used tweepy from: https://code.google.com/p/tweepy/downloads/detail?name=tweepy-1.4-py3.tar.gz

It gave me a 410 error. Apparently Twitter changed her API in the meanwhile suggesting me to use API 1.1, according to Twitter error codes shown here.

After searching I found:

“Twitter for Python! An update of original Tweepy to gain compatibility with Python 3”

git clone https://github.com/felHR85/Tweepy-3.git
cd Tweepy-3/
sudo python3.2 setup.py install

Create app using oauth authentication at: https://dev.twitter.com/apps

Using this example: https://github.com/felHR85/Tweepy-3/blob/master/examples/oauth.py
I created a testscript “twitter.py”:

#!/usr/bin/python3.2
import tweepy
import sys
CONSUMER_KEY = '...'
CONSUMER_SECRET = '...'
ACCESS_KEY = '...'
ACCESS_SECRET = '...'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
# If the authentication was successful, you should
# see the name of the account print out
print (api.me().name)
# If the application settings are set for "Read and Write" then
# this line should tweet out the message to your account's
# timeline. The "Read and Write" setting is on https://dev.twitter.com/apps
#api.update_status('Updating using OAuth authentication via Tweepy!')
api.update_status(sys.argv[1]

chmod 755 twitter.py.

./twitter.py ‘foobar’

Source: http://talkfast.org/2010/05/31/twitter-from-the-command-line-in-python-using-oauth/

 

2 thoughts on “Howto install Tweepy for python3.2 using debian Wheezy

  1. I must tell you that it’s hard to find your articles in google, i found this one on 16 spot, you should build some quality backlinks
    in order to rank your site, i know how to help you, just search in google – k2 seo tips and tricks

Leave a Reply

Your email address will not be published. Required fields are marked *

*