from twython import Twython
import glob
import random
import time
import tweepy
app_key = "IL2cl4l0utXc1aStFKvZNkS0F"
app_secret = "JtGkcWmyzQDWVpiVeM9mFUWSAYqjAux4z6p4qUVoSVuLuJlFps"
oauth_token = "1206083934603431936-fZ9vf2mVrNaIW04DoPBKMcb3Vcd1Op"
oauth_token_secret = "TSlorK1nYa9LYfA2UIgvObX4tv9m50kKv2o2H4abhWQPY"
twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret)
auth = tweepy.OAuthHandler(app_key, app_secret)
auth.set_access_token(oauth_token, oauth_token_secret)
api = tweepy.API(auth)
screen_name=""
#timeline = api.user_timeline(, count = 550)
timeline = api.user_timeline(screen_name=screen_name, count = 550, include_rts = False)
print(f"{timeline[0].user.name} said {timeline[0].text}")
if timeline[0].text.find("My Room")!=-1:
api.destroy_status(timeline[0].id)
print("Hallo");
seconds = time.time()
tweettime = time.ctime (seconds)
photo = open('./snapshot.jpg', 'rb')
response = twitter.upload_media(media=photo)
text = ' ' + "My Room - "
twitter.update_status(status=tweettime + text, media_ids=[response['media_id']])