220
58

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 5 years have passed since last update.

修学旅行にインフルで行けないので10分ごとに行きたいツイートをする

Last updated at Posted at 2019-01-23

#背景
修学旅行前日にインフルエンザになりました
行けなくてあまりにも悔しいので10分ごとに「修学旅行行きたい」ツイートするようにしました
#プログラム

from twython import Twython,TwythonError 
import datetime
import time
#twitterの認証情報を入力 
CONSUMER_KEY = "XXXXXXXXXXXXXXXXXXXXXX"
CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXXXXX' 
ACCESS_KEY = 'XXXXXXXXXXXXXXXXXXXXXX' 
ACCESS_SECRET = 'XXXXXXXXXXXXXXXXXXXXXX' 
api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET) 
print('Auth Done!')

while True:
    #日時取得(重複ツイートを避けるためにツイートに日時の情報をstrで入れる)
    now = datetime.datetime.now()
    api.update_status(status='修学旅行行きたい\n' + str(now))
    print(now)
    time.sleep(600)#〜秒ごとに繰り返す

#実行
10分ごとでやったらTL埋め尽くして申し訳なかったので1時間ごとに変更しました
IMG_2136.png
https://twitter.com/nya3_neko2/status/1088082093437902848
#おわりに
修学旅行行きたい

220
58
9

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
220
58

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?