Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import time
- import datetime
- from twython import Twython, TwythonError
- def check():
- condition = "Tell me the date"
- twitter = Twython("")
- print("\n")
- feed = twitter.get_user_timeline(screen_name="jarvis_788")
- f = open("LastTweet.txt","r")
- data = f.read()
- f.close
- if data == condition:
- check()
- f = open("LastTweet.txt",'w')
- f.write(condition)
- for tweet in feed[:1]:
- if tweet["text"] == "Tell me the date":
- import httplib, urllib
- conn = httplib.HTTPSConnection("api.pushover.net:443")
- conn.request("POST", "/1/messages.json",
- urllib.urlencode({
- "token": "",
- "user": "",
- "message": "The date is "+str(datetime.date.today())+" sir",
- }), { "Content-type": "application/x-www-form-urlencoded" })
- conn.getresponse()
- check()
- def main():
- while True:
- check()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment