pip install tweepy
CONSUMER_KEY = '<input plase>' CONSUMER_SECRET = '<input plase>' ACCESS_TOKEN = '<input plase>' ACCESS_TOKEN_SECRET = '<input plase>' def authenticate_to_twitter(): api = tweepy.Client( consumer_key = CONSUMER_KEY, consumer_secret = CONSUMER_SECRET, access_token = ACCESS_TOKEN, access_token_secret = ACCESS_TOKEN_SECRET, ) return api def post_tweet(api, tweet_text): tweet = api.create_tweet(text = tweet_text) tweet_text = "投稿文字列" api = authenticate_to_twitter() post_tweet(api, tweet_text)