diff --git a/AvivoreXT/__init__.py b/AvivoreXT/__init__.py index e69de29..5a5df3b 100644 --- a/AvivoreXT/__init__.py +++ b/AvivoreXT/__init__.py @@ -0,0 +1 @@ +__version__ = '1.2.3' diff --git a/AvivoreXT/avivore.py b/AvivoreXT/avivore.py index dc0cef3..4e529aa 100644 --- a/AvivoreXT/avivore.py +++ b/AvivoreXT/avivore.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf8 -*- +import AvivoreXT from twitter import * import time import re @@ -73,17 +74,17 @@ def read_config(self): qresult = dbcur.fetchone() if qresult is not None: # We should only have to pull one. # read search term definitions - twitter_search_term = qresult[5].strip(" '\"\n") + twitter_search_term = qresult[5].strip(" \n") twitter_search_terms_raw = twitter_search_term.split(',') for x in twitter_search_terms_raw: self.twitter_search_terms.append(x) # read other settings - self.database_path = qresult[0].strip("'\"") - self.twitter_consumer_key = qresult[1].strip("'\"") - self.twitter_consumer_secret = qresult[2].strip("'\"") - self.credentials_file = qresult[3].strip("'\"") - self.twitter_track_keywords = qresult[4].strip("'\"") + self.database_path = qresult[0].strip() + self.twitter_consumer_key = qresult[1].strip() + self.twitter_consumer_secret = qresult[2].strip() + self.credentials_file = qresult[3].strip() + self.twitter_track_keywords = qresult[4].strip() self.twitter_search_interval = int(qresult[6]) else: failed = True @@ -339,6 +340,7 @@ def twitter_query_main(avivore): # continuously checks twitter stream API def twitter_stream_main(avivore): + Output("Beginning stream processing [S].") stored = [] twitter_stream_inst = avivore.twitter_stream_auth() @@ -393,7 +395,7 @@ def SoftwareExit(status, message): def start(): - SoftwareInitMsg("1.2.3.dev1") + SoftwareInitMsg(AvivoreXT.__version__) CheckUsage(sys.argv) try: main(sys.argv) diff --git a/README.md b/README.md index b878692..b018719 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,12 @@ and `consumer_secret` in section `twitter_auth`. Both values can be obtained from https://dev.twitter.com/apps after registration of a new Twitter app. Comments explain all remaining options in the config file. After defining data sets and search terms as needed you're good to go. Both are located in sections -`twitter_search_objects` and `twitter_search` respectively. Tracking keywords +`twitter_search_objects` and `twitter_search` respectively. [Tracking keywords]( +https://dev.twitter.com/streaming/overview/request-parameters#track) that are used to monitor the Twitter Streaming API can be configured by setting the option `stream_tracking_keyword` which is also found in section -`twitter_search`. +`twitter_search`. Check out the sample config file `sample.conf` for more +information regarding the configuration options! Running AvivoreXT is quite easy: diff --git a/sample.conf b/sample.conf index 53817e5..2d5577e 100644 --- a/sample.conf +++ b/sample.conf @@ -42,9 +42,9 @@ credentials_file: '.avivore.cred' # twitter search definitions # Tracking keyword: # String that contains all keywords that are tracked using -# the Twitter streaming API. Separate keywords by ','. No -# spaces allowed. Use \'contains spaces\' to add keywords -# containing spaces. +# the Twitter streaming API. Separate keywords by ','. Use +# spaces to create tracking phrases. For more info see: +# https://dev.twitter.com/streaming/overview/request-parameters#track # # Search terms: # Search terms are enclosed in '\'' and separated by ','. @@ -52,13 +52,15 @@ credentials_file: '.avivore.cred' # # Search interval: # Specifies time interval (in seconds) to wait between to -# consecutive search queries. +# consecutive search queries. You'll want to set this to 30 +# seconds or higher to avoid hitting Twitter's Streaming API +# rate limits! ### [twitter_search] # Used to filter tweets from Twitter Streaming API -stream_tracking_keyword: 'ip,bbm,\'bb pin\',bb,bbm,pin,call,phone,text,number' +stream_tracking_keyword: 'ip,bbm,bb pin,bb,bbm,pin,call,phone,text,number' # Used to issue separate search queries for each term csv_search_term: 'ip server', 'ip address', 'blackberry pin', 'bb pin', 'bbm pin', 'text me', 'call me', 'phone me', 'new phone', 'new number' -# You'll want to set this to 10 seconds or higher! -interval: 30 +# You'll want to set this to 30 seconds or higher! +interval: 120 diff --git a/sample_conf.db b/sample_conf.db index 21dd17f..4d72728 100644 Binary files a/sample_conf.db and b/sample_conf.db differ diff --git a/setup.py b/setup.py index f036186..15211cd 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,14 @@ #!/usr/bin/env python +import AvivoreXT from setuptools import setup, find_packages -version = '1.2.3.dev1' - dependencies = ['twitter'] scripts = ['avivore'] setup(name='AvivoreXT', - version=version, + version=AvivoreXT.__version__, description='Twitter data mining tool', long_description=open("./README.md", "r").read(), classifiers=[