Created
December 30, 2009 08:18
-
-
Save ryanmcgrath/265912 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import twython, csv | |
# We're going to read in a CSV file full of Twitter IDs, and see | |
# if they're still following us or not, as well as if I'm still following them | |
# or not. If either case turns up negative, we're gonna fix it by establishing | |
# a relationship and giving them a heads up. | |
# Get our Twython instance going, so we can talk back and forth with Twitter | |
twitter = twython.core.setup("ryanmcgrath", "*********************") | |
# Store our Twitter Follower for comparison down the road | |
followerIDs = twitter.getFollowersIDs(screen_name="ryanmcgrath")["ids"] | |
# Open up our CSV file for parsing | |
twitterPeople = csv.reader(open("ryansblockedfollowers.csv")) | |
# Copy our values into new memory, because CSV is annoying about keeping data good (not sure why) | |
twitPeople = [] | |
for row in twitterPeople: | |
if row[0] == "twitter_id": | |
pass | |
else: | |
# Append the id and screen name | |
twitPeople.append([row[0], row[1]]) | |
for row in twitPeople: | |
print "%s, %s" % (row[0], row[1]) | |
# Run a check on whether or not the user is following us - if they're not, message them and let them know what's up | |
if row[0] not in followerIDs: | |
print "@%s I lost you as a follower due to an accident a few weeks back. Feel free to refollow, sorry for spam. ;)" % row[1] | |
twitter.updateStatus("@%s I lost you as a follower due to an accident a few weeks back. Feel free to refollow, sorry for spam. ;)" % row[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment