Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#coding; utf-8
from requests_oauthlib import OAuth1Session
import json
import settings   #ここでトークンなどの設定ファイルを読み込む。
import random
import datetime
twitter = OAuth1Session(settings.CONSUMER_KEY, settings.CONSUMER_SECRET, settings.ACCESS_TOKEN, settings.ACCESS_TOKEN_SECRET)
tweets = ["にゃーん","わおーん"]   #ここにツイートする内容を入れる
randomtweet = tweets[random.randrange(len(tweets))]
timestamp =
timestamp = str(timestamp.strftime("%Y/%m/%d %H:%M"))   #タイムスタンプを用意
params = {"status": randomtweet + " " + timestamp}
req ="", params = params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.