Jan 21, 2016
first version
|
|
|
1 |
import json |
|
2 |
import tweepy |
|
3 |
import sys |
|
4 |
import pprint |
|
5 |
import os |
|
6 |
import ConfigParser |
|
7 |
import time |
|
8 |
|
|
9 |
tweetid = sys.argv[1] |
|
10 |
|
|
11 |
config = ConfigParser.ConfigParser() |
|
12 |
config.read('twitter.ini') |
|
13 |
|
|
14 |
consumer_key = config.get('Twitter', 'consumer_key') |
|
15 |
consumer_secret = config.get('Twitter', 'consumer_secret') |
|
16 |
access_key = config.get('Twitter', 'access_key') |
|
17 |
access_secret = config.get('Twitter', 'access_secret') |
|
18 |
|
|
19 |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) |
|
20 |
auth.set_access_token(access_key, access_secret) |
|
21 |
api = tweepy.API(auth) |
|
22 |
|
|
23 |
try: |
|
24 |
tweets = api._statuses_lookup(id=tweetid) |
|
25 |
for tweet in tweets: |
|
26 |
print json.dumps(tweet.json) |
|
27 |
print tweet |
|
28 |
except: |
|
29 |
sys.exit() |