Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Make hashtag configurable.
Browse files Browse the repository at this point in the history
It's useful to use a different hashtag while testing.
  • Loading branch information
nicolas17 committed Jul 26, 2017
1 parent 5e22d5a commit e3e67d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ access_token=
access_token_secret=

[sysarmy]
max_beers=3
max_beers=3
hashtag=downtime99999
5 changes: 4 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, path):
if key not in self.config['credentials']:
raise RuntimeError("Required setting %s not found in [credentials]" % key)

for key in ['max_beers']:
for key in ['max_beers', 'hashtag']:
if key not in self.config['sysarmy']:
raise RuntimeError("Required setting %s not found in [sysarmy]" % key)

Expand All @@ -29,3 +29,6 @@ def get_tweepy_auth(self):

def max_beers(self):
return int(self.config['sysarmy']['max_beers'])

def hashtag(self):
return self.config['sysarmy']['hashtag']
5 changes: 2 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def on_error(self, status):
auth = config.get_tweepy_auth()
api = API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)

searchQuery = '%23downtime99999'
searchQuery = '%23' + config.hashtag()

# Maximum number of tweets we want to collect
maxTweets = 1000000
Expand All @@ -77,6 +77,5 @@ def on_error(self, status):
print("Downloaded {0} tweets".format(tweetCount))

# http://www.dealingdata.net/2016/07/23/PoGo-Series-Tweepy/
exit(0)
stream = Stream(auth, l)
stream.filter(track=['downtime99999'])
stream.filter(track=[config.hashtag()])

0 comments on commit e3e67d1

Please sign in to comment.