Created
August 5, 2010 22:10
-
-
Save moonhouse/510478 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
# 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