Skip to content

Instantly share code, notes, and snippets.

@moonhouse
Created August 5, 2010 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moonhouse/510478 to your computer and use it in GitHub Desktop.
Save moonhouse/510478 to your computer and use it in GitHub Desktop.
# Client to control electrical appliances based on Twitter activity.
# Uses Tellstick USB (using Remotestick REST API http://wiki.github.com/pakerfeldt/remotestick/ ) and
# the Twitter API.
import twitter
import time
import httplib
api = twitter.Api()
api = twitter.Api(username='moonhouse', password='secret')
prevstatus = api.GetReplies()[0].id
while 1:
statuses = api.GetReplies()
print statuses[0].id
if(prevstatus != statuses[0].id):
conn = httplib.HTTPConnection("127.0.0.1:8422")
conn.request("GET", "/devices/7/on.xml")
conn.close()
prevstatus = statuses[0].id
time.sleep(120)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment