Last active
March 13, 2017 17:13
-
-
Save hitowaft/07cbcb65662959a81653d6bd43f2944c to your computer and use it in GitHub Desktop.
bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 = datetime.datetime.today() | |
timestamp = str(timestamp.strftime("%Y/%m/%d %H:%M")) #タイムスタンプを用意 | |
params = {"status": randomtweet + " " + timestamp} | |
req = twitter.post("https://api.twitter.com/1.1/statuses/update.json", params = params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment