script/stream/recorder_tweetstream.py
changeset 290 2ddd11ec2da2
parent 289 a5eff8f2b81d
child 425 b346fd32fc34
--- a/script/stream/recorder_tweetstream.py	Thu Sep 22 12:37:53 2011 +0200
+++ b/script/stream/recorder_tweetstream.py	Wed Oct 05 13:39:57 2011 +0200
@@ -1,7 +1,7 @@
 from getpass import getpass
 from iri_tweet import models, utils
 from iri_tweet.models import TweetSource, TweetLog, ProcessEvent
-from multiprocessing import (Queue as mQueue, JoinableQueue, Process, Event,
+from multiprocessing import (Queue as mQueue, JoinableQueue, Process, Event, 
     get_logger)
 from optparse import OptionParser
 from sqlalchemy.exc import OperationalError
@@ -187,7 +187,7 @@
         track_list = [k for k in track_list.split(',')]
 
         self.logger.debug("SourceProcess : before connecting to stream " + repr(track_list))                        
-        stream = ReconnectingTweetStream(self.auth, track_list, reconnects=self.reconnects, as_text=True)
+        stream = ReconnectingTweetStream(self.auth, track_list, reconnects=self.reconnects, as_text=True, url=self.options.url)
         self.logger.debug("SourceProcess : after connecting to stream")
         stream.muststop = lambda: self.stop_event.is_set()
         
@@ -343,6 +343,9 @@
                       help="Duration of recording in seconds", metavar="DURATION", default= -1, type='int')
     parser.add_option("-N", "--nb-process", dest="process_nb",
                       help="number of process.\nIf 0, only the lefovers of the database are processed.\nIf 1, no postprocessing is done on the tweets.", metavar="PROCESS_NB", default=2, type='int')
+    parser.add_option("--url", dest="url",
+                      help="The twitter url to connect to.", metavar="URL", default=tweetstream.FilterStream.url)
+
 
     utils.set_logging_options(parser)