-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
120 lines (88 loc) · 2.61 KB
/
README
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Civic Paths Bot
====================================
Simple Python module for creating
bots that track and RT tweets based
on keywords/phrases.
Configuration
====================================
Your bot's configuration is stored
in HISTORY_FILENAME
The first time you run the bot, an
empty configuration file is created.
You will have to edit this by hand.
The empty config file looks like this:
{
"BOT_USER_ID": "",
"KEYWORDS": [],
"BLACKLIST": [],
"CONSUMER_KEY": "",
"CONSUMER_SECRET": "",
"OAUTH_TOKEN": "",
"OAUTH_TOKEN_SECRET": ""
}
BOT_USER_ID refers to the unique
numerical ID assigned by Twitter to
each user. If you don't know yours:
* http://www.idfromuser.com
KEYWORDS contains a list of strings
to search with, e,g.
["#civicpaths","civic engagement"]
BLACKLIST contains a list of integers
corresponding to Twitter user IDs to
to ignore.
CONSUMER_KEY, CONSUMER_SECRET,
OAUTH_TOKEN, and OAUTH_TOKEN_SECRET
refer to Twitter's OAuth validation
process. Most people reading this
should set up a single-use token:
* https://dev.twitter.com/docs/auth/oauth/single-user-with-examples
Typical usage
====================================
The typical() function represents a
simple sequence that you might use in
a cron job.
* Load history
* Search for each keyword
* Process the new tweets
* Send out RTs
* Dump history
* Quit
Note on History
====================================
Civic Paths Bot was designed for a
very low traffic situation (1-2 tweets
per day.) The history file will get
quite large if your search criteria
is more broad.
One work around is to periodically
archive the history files by hand.
As long as you maintain the values for
lastupdate and since_id, the bot will
avoid duplicating old messages.
An example of a blank history might
be:
{
"lastupdate": "2011-10-08 14:17:14.114872",
"since_id": "122503982349426688",
"tweets": {}
}
Wishlist
====================================
* Improve history system to handle very large numbers of tweets
* Setup commandline params
* Respond to DMs, @s, follows
* Handle Twitter HTTP errors smarter
** https://dev.twitter.com/docs/error-codes-responses
* Walk new users through the OAUTH process
** https://dev.twitter.com/docs/auth/oauth
About Civic Paths Bot
====================================
Developed for the Civic Paths research group
* http://civicpaths.uscannenberg.org
Depends on Python Twitter Tools:
* http://mike.verdone.ca/twitter/
This version of Civic Paths Bot was released under an MIT License.
Credits
====================================
Developers:
Kevin Driscoll <[email protected]>