@ -51,7 +53,8 @@ class TwittStreamHandler(tweepy.StreamListener):
else:
else:
toSend=packet
toSend=packet
print" >> Received packet with id",packetId
print" >> Received packet with id",packetId
printrepr(toSend)
ifself.debug:
printrepr(toSend)
self.dev.write(toSend)
self.dev.write(toSend)
defon_limit(self,track):
defon_limit(self,track):
@ -66,15 +69,18 @@ class TwittStreamHandler(tweepy.StreamListener):
sys.exit(2)
sys.exit(2)
else:
else:
print"At the moment there is no error-handling for this, so we just kill everything. Remember: This software doesn't even deserve the label 'alpha' ;)"
print"At the moment there is no error-handling for this, so we just kill everything. Remember: This software doesn't even deserve the label 'alpha' ;)"
#sys.exit(1)
sys.exit(1)
defon_timeout(self,status_code):
defon_timeout(self,status_code):
print"Got an timeout: ",status_code
print"Got an timeout: ",status_code
print"At the moment there is no error-handling for this, so we just kill everything. Remember: This software doesn't even deserve the label 'alpha' ;)"
print"At the moment there is no error-handling for this, so we just kill everything. Remember: This software doesn't even deserve the label 'alpha' ;)"
sys.exit(1)
# TODO: Thread is not needed, tweepy has its own threading. remove it
classDownstreamThread(threading.Thread):
classDownstreamThread(threading.Thread):
def__init__(self,dev,auth,endpoint):
def__init__(self,dev,auth,endpoint, debug=False):
threading.Thread.__init__(self)
threading.Thread.__init__(self)
self.debug=debug
self.auth=auth
self.auth=auth
self.api=tweepy.API(self.auth)
self.api=tweepy.API(self.auth)
self.endpoint=endpoint
self.endpoint=endpoint
@ -82,17 +88,16 @@ class DownstreamThread(threading.Thread):