#!/usr/bin/python
__author__ = 'keyz'

import os

POSTGRES_IP = os.environ['POSTGIS21_PORT_5432_TCP_ADDR']
POSTGRES_PORT = os.environ['POSTGIS21_PORT_5432_TCP_PORT']
TWITTER_APP_KEY = os.environ['TWITTER_APP_KEY']
TWITTER_APP_SECRET = os.environ['TWITTER_APP_SECRET']
TWITTER_OAUTH_TOKEN = os.environ['TWITTER_OAUTH_TOKEN']
TWITTER_OAUTH_TOKEN_SECRET = os.environ['TWITTER_OAUTH_TOKEN_SECRET']

COLLECTION_TYPE = os.environ['COLLECTION_TYPE']

TABLE_NAME = os.environ['TABLE_NAME']

from Streamer import SentinelStreamer, StreamForever

twitter_auth = { 'app_key' : TWITTER_APP_KEY,
                'app_secret' : TWITTER_APP_SECRET,
                'oauth_token' : TWITTER_OAUTH_TOKEN,
                'oauth_token_secret' : TWITTER_OAUTH_TOKEN_SECRET }

location =  '-4.4289,51.3484,-2.7684,52.0228'
table_name = TABLE_NAME + "_geo_tweets"
non_geo_table_name = TABLE_NAME + "_tweets"
dbString = "host={0} port={1} dbname=docker user=docker password=docker".format(POSTGRES_IP, POSTGRES_PORT)

stream = SentinelStreamer(twitter_auth=twitter_auth,
                    table_name=table_name,
                    non_geo_table_name=non_geo_table_name,
                    dbString=dbString)

if COLLECTION_TYPE == 'geo':
    BBOX = os.environ['BBOX']
    StreamForever(stream,locations=BBOX)
else:
    TERMS = os.environ['SEARCHTERMS']
    StreamForever(stream, track=TERMS)


@@ -1187,66 +1187,172 @@
 g)%0A%0A
-if COLLECTION_TYPE == 'geo':%0A    BBOX = os.environ%5B'BBOX'%5D
+%0ABBOX = os.environ%5B'BBOX'%5D%0ATERMS = os.environ%5B'SEARCHTERMS'%5D%0A%0Aif COLLECTION_TYPE == 'geo':%0A    StreamForever(stream, locations=BBOX)%0Aelif COLLECTION_TYPE == 'both':
 %0A   
@@ -1373,16 +1373,30 @@
 (stream,
+ track=TERMS, 
 location
@@ -1413,46 +1413,8 @@
 se:%0A
-    TERMS = os.environ%5B'SEARCHTERMS'%5D%0A
     

Update collector.py