i'm trying to create my first Twitter bot using Twitter API V.2 and Tweepy. So i can post simple text Tweets but i haven't found how to post tweets with medias (pictures) so how can i do that ? (I saw that some people say "you can't post media tweets using twitter API v2... You need to use API V 1.1 " so if it's true how can i use Twitter API V1.1 instead of API V2 ? )
Thank you if you can help me ^^
Here is my actual code :
from io import BytesIO
from PIL import Image
import tweepy
from tweepy import API
consumer_key = "APP_KEY"
consumer_secret = "APP_SECRET_KEY"
access_token = "TOKEN"
access_token_secret = "SECRET_TOKEN"
client = tweepy.Client(
consumer_key=consumer_key,
consumer_secret=consumer_secret,
access_token=access_token,
access_token_secret=access_token_secret
)
response = client.create_tweet(
text="Just a dummy tweet",
# in_reply_to_tweet_id= 1484105392598749186 <--- Reply to a tweet by ID
)
print(f"https://twitter.com/user/status/{response.data['id']}")