Don't load unallowed tweets

This commit is contained in:
Manuel Cortez 2015-02-08 05:48:40 -06:00
parent 42aea45a41
commit d2cffe65d8
3 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from twitter import compose
from twitter import compose, utils
from twython import TwythonStreamer
from pubsub import pub
import logging as original_logger
@ -26,7 +26,7 @@ class timelinesStreamer(TwythonStreamer):
def on_success(self, data):
# try:
if "text" in data:
if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
self.check_tls(data)
# except:
# pass

View File

@ -94,7 +94,7 @@ class streamer(TwythonStreamer):
self.process_dm(data)
elif "friends" in data:
self.friends = data["friends"]
elif "text" in data:
elif "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
if data["user"]["id"] in self.muted_users: return
self.check_mentions(data)
self.check_send(data)

View File

@ -99,6 +99,7 @@ def api_call(parent=None, call_name=None, preexec_message="", success="", succes
return val
def is_allowed(tweet, clients):
if tweet.has_key("sender"): return True
allowed = True
if tweet.has_key("retweeted_status"): tweet = tweet["retweeted_status"]
source = re.sub(r"(?s)<.*?>", "", tweet["source"])