[PYTHON] Kuribocchi Comfort Program

Hi, this is Nagamasa Yamada Why Christmas, a program to like Twitter's Kuribocchi tweets I made.

What is

python tweepy

program

Enter the number of times to press in the place of count.

tw.py



import tweepy
from time import sleep

consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
access_token = 'xxxxxxxxxxxxxxxxxx'
access_token_secret = 'xxxxxxxxxxxxxxxxx'



auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

    
for status in api.search(q='Kuribotti', count=10000):
    tweet_id = status.id
#Handle exceptions
    try:
#Like run
        api.create_favorite(tweet_id)
        print("ok")
    except:
        print('error')

Recommended Posts

Kuribocchi Comfort Program