ちょっと @yasulabot というネタbotをつくるためだけに、SimpleTwitterBotを弄り直しました。基本的にはREADMEに書かれている通りにregister_pin.pyを実行すれば、OAuth周りの設定は勝手にやってくれるはずですが、個人的につまずいたポイントをちょろっとリストにしてみます。
- 1. botのtwitterアカウントでログインしたブラウザで、OAuthに登録する事。ChromeならCtrl+Shift+Nで開いたブラウザでbotアカウントにログインして、OAuthに登録すると楽。
- 2. デフォルトのAPIのpermissionは"Read only"なので、APIを通してtweetとかdeleteとかしたいならOAuthの設定画面から、Permissionを"Read & Write"に変更すること。
- 3. たぶん、Windowsだとうまく動かない(Issue 1)。Windows非対応。
基本的にこれらの点に注意して、あとはREADME通りにやれば、自作BotがGAE上で動くような気がします。
README(引用):
This bot runs in the following ways.1. Search tweets using 'search_term' in Twitter.2. Re-tweet the tweets.In this example, 'search_term' is 'Cafe Miyama',and you can see how it behaves by checking the following account.HOW TO SETUP:1. Register your OAuth client on TwitterNOTE: You MUST change permission settings to "Read & Write" if you wanna update via API.The default is "Read Only".2. Run 'python register_pin.py' anduse CONSUMER_KEY and CONSUMER_SECRET you got from the registeration.NOTE: Make sure you are now signing in Twitter as your Bot account when visiting a given URL.3. Change setting variables (CONSUMER_KEY and CONSUMER_SECRET) in main.py to the given ones.4. Run Google App Engine dev_server and visit the following URL* If you finish all of your setting, set 'debug_flag' in main.py off.5. Done!Enjoy developing your own twitter bot!YasuLabyasulab@gmail.com
参考:OAuth on Simple Twitter Bot
0 件のコメント:
コメントを投稿