Sie sind auf Seite 1von 1

from twitter.

api import Twitter, TwitterError


from twitter.oauth import OAuth
from twitter.oauth import read_token_file
from twitter.oauth_dance import oauth_dance
import os
from twitter.util import htmlentitydecode
from dateutil.parser import parse

OAUTH_FILE = os.environ.get('HOME', '') + os.sep + '.twitter_oauth'


oauth_token, oauth_secret = read_token_file(OAUTH_FILE)
CONSUMER_KEY = "XryIxN3J2ACaJs50EizfLQ"
CONSUMER_SECRET = "j7IuDCNjftVY8DBauRdqXs4jDl5Fgk1IJRag8iE"

twitter = Twitter(auth=OAuth(oauth_token, oauth_secret, CONSUMER_KEY,


CONSUMER_SECRET),api_version='1',domain='api.twitter.com')

try:
updates = twitter.statuses.friends_timeline()
except Exception, e:
print >> sys.stderr, "Exception while querying twitter:"
traceback.print_exc(file=sys.stderr)

for update in updates:


crt = parse(update['created_at']).utctimetuple()
text = (htmlentitydecode(update['text'].replace('\n', ' ')).encode('utf-8',
'replace'))
print text

Das könnte Ihnen auch gefallen