Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Minor changes, stream tracking checked (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rc0r committed Jan 1, 2015
1 parent 8067b7c commit c19203c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
1 change: 1 addition & 0 deletions AvivoreXT/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '1.2.3'
16 changes: 9 additions & 7 deletions AvivoreXT/avivore.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-

import AvivoreXT
from twitter import *
import time
import re
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
16 changes: 9 additions & 7 deletions sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,25 @@ 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 ','.
# They are added to the variable 'csv_search_term'.
#
# 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
Binary file modified sample_conf.db
Binary file not shown.
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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=[
Expand Down

0 comments on commit c19203c

Please sign in to comment.