0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

tweepy で 画像付きツイート

Posted at

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を使って投稿しようね

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?