-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_searchkeyword.py
31 lines (25 loc) · 1.08 KB
/
test_searchkeyword.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import ConfigParser
from searchkeyword import SearchKeyword
def main():
inifile = ConfigParser.SafeConfigParser()
inifile.read("./config.ini")
for tweet in SearchKeyword(
inifile.get('twitter_api', 'consumer_key'),
inifile.get('twitter_api', 'consumer_secret'),
inifile.get('twitter_api', 'access_token'),
inifile.get('twitter_api', 'access_token_secret'),
inifile.get('search', 'keyword'),
long(inifile.get('search', 'last_tweet_id')),
int(inifile.get('search', 'max_tweet'))):
print('==========================================================')
print( "screen_name: {0}".format( tweet['screen_name']) )
print( u"user_name: {0}".format( tweet['user_name'] ) )
print( u"text: {0}".format( tweet['text'] ) )
print( "profile_image_url: {0}".format( tweet['profile_image_url']) )
print( "created_at: {0}".format( tweet['created_at']) )
print( "id: {0}".format( tweet['id'] ) )
if __name__ == '__main__':
sys.exit(main())