Changeset 691 for confluence

Show
Ignore:
Timestamp:
11/25/09 11:10:07 (8 months ago)
Author:
confluence
Message:

never block people you're following if they try to follow you

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • confluence/emailfilters/twitterbouncer.py

    r679 r691  
    1313import re 
    1414try: 
    15     from twyt import twitter 
     15    from twyt import twitter, data 
    1616except ImportError: 
    1717    print "Dude, you need to install the python twyt module for this to work." 
     
    9393        t = twitter.Twitter() 
    9494        t.set_auth(username, password) 
    95         t.block_create(user) 
     95 
     96        friendstring = t.user_friends() 
     97        friends = data.simplejson.loads(friendstring) 
     98        friendnames = [f["screen_name"] for f in friends] 
     99        if unicode(user) in friendnames: 
     100            print "You're following this person!  Not blocking." 
     101        else: 
     102            print "BLOCKING!" 
     103            t.block_create(user) 
    96104    except Exception, e: 
    97105        print "Out of cheese error, redo from start: %s" % e