# set credentials in credentials.py
from credentials import API_KEY, API_SECRET, CLIENT_TOKEN, CLIENT_SECRET

import tweepy
import json


class StdOutListener(tweepy.streaming.StreamListener):
    """ A listener handles tweets are the received from the stream.
    This is a basic listener that just prints received tweets to stdout.

    """
    def on_data(self, data):
        data = json.loads(data)
        print data.get('text')
        try:
            api.create_favorite(data.get('id'))
            api.create_friendship(data.get('user').get('id'))
        except:
            pass
        return True

    def on_error(self, status):
        print status


l = StdOutListener()
auth = tweepy.OAuthHandler(API_KEY, API_SECRET)
auth.set_access_token(CLIENT_TOKEN, CLIENT_SECRET)
api = tweepy.API(auth)

stream = tweepy.Stream(auth, l)
stream.filter(track=['schnitzel', '#schnitzel', '#schnitzelbot'])

@@ -432,25 +432,8 @@
 t')%0A
-        try:%0A    
     
@@ -476,24 +476,147 @@
 '))%0A        
+if not api.exists_friendship(api.me().get('id'),%0A                                     data.get('user').get('id')):%0A        
     api.crea
@@ -660,41 +660,8 @@
 d'))
-%0A        except:%0A            pass
 %0A   

check if bot already follows