import twitter import urllib from getpass import getpass def isitgoingtorain(): answerPage = urllib.urlopen("http://www.goingtorain.com") while answerPage.readline().find("<div id=\"answer\">") is -1: pass tmpLine = answerPage.readline() if tmpLine.find("yes") is not -1: return "yes." elif tmpLine.find("no") is not -1: return "no." else: return "FAILED" def createApp(username, password): twitterSystem = twitter.Api(username, password) return twitterSystem user = raw_input("Enter your username - ") pword = getpass("Enter your password - ") twitterSystem = createApp(user, pword) tmp = isitgoingtorain() if tmp is not "FAILED": print "Posting..." twitterSystem.PostUpdate("APERTURE SCIENCE AUTOMATIC FUTURE RAIN STATUS PREDICTION SCRIPT RESULT: " + tmp) else: print "Failed... could not get rain update."
Wednesday, March 10, 2010
March Madness Entry 10
A common theme, to be sure. I'll leave it at that. But when you throw a dying router into the mix with five laptops on it, and suddenly testing your IRC bot becomes a slow, arduous, and sometimes fruitless task. Tonight's code? A rehash of last nights with an added twist.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment