tweepy がインスコされていることが条件
pythonでツイートしたい
hoge.py
import tweepy
client = tweepy.Client(
consumer_key=API_KEY,
consumer_secret=API_KEY_SECRET,
access_token=ACCESS_TOKEN,
access_token_secret=ACCESS_TOKEN_SECRET
)
auth = tweepy.OAuthHandler(API_KEY, API_KEY_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
tweet_txt = "あいうえお"
tw_img_pass = "screen_shots/hoge.png"
media = api.media_upload(tw_img_pass)
api.update_status(status=tweet_txt, media_ids=[media.media_id])
こんな感じ。
APIV2だと無理みたいなので、V1を使って投稿しようね