import random
import tweepy
 
#remplacer par api key et api secret key
auth = tweepy.OAuthHandler('y8NZDksFgMQAlt8mjmuEXBpPx', 'Qg9ewpG3H69GxMdEFQGZfG8oHsTEF1ihJKtH1HYXtAVrixHpqi')
auth.set_access_token('1361243805157048323-Low25zyn10mK7cGebx3XbatqLbeMcP', 'sXpDm0LN1mguv9JqmgcSW3u0rJMFNS5PfcoglLgCzp9pQ')
api = tweepy.API(auth)

with open("idioms.txt" , 'r') as file :
 idioms = file.read()



lignes = idioms.splitlines()


phrase = '"'+random.choice(lignes)+'"'

print(phrase)

tweets = tweepy.Cursor(api.search, q= phrase, tweet_mode='extended').items(1) 

for resultat in tweets:
    print(resultat)
    print(resultat.full_text)
    api.retweet(resultat.user.id)
    api.me()
    

