Skip to content

Instantly share code, notes, and snippets.

@harrisony
Created December 4, 2009 23:59
Show Gist options
  • Save harrisony/249472 to your computer and use it in GitHub Desktop.
Save harrisony/249472 to your computer and use it in GitHub Desktop.
import tweepy
username = 'hugsbot'
password = 'secret'
api = tweepy.API(tweepy.BasicAuthHandler(username,password))
def givehugs():
for follower in tweepy.Cursor(api.followers).items():
print follower.screen_name
api.update_status('@%s Hi, this is your daily hug *hug*' % follower.screen_name)
hugssince = 0
def searchhugs():
global hugssince
search = api.search('"I need a hug"', rpp=20,since_id=hugssince)
hugssince = search[0].id
for i in search:
print i.text, i.from_user
api.update_status('@%s Hi, I hear you need a hug. *hug*' % i.from_user, in_reply_to_status_id=i.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment