複数人で共用TwitterIDを投稿フォームから利用
はじめに
n00dle: 新しくひとつTwitterIDを取得して、フォームから発言をAPIで投稿するようにすれば共用にできるな、ということでサークル用にひとつ作ってみた。会室の管理や勉強会のときに使えそうだがそもそも部員についったらがほぼいないので無駄
http://twitter.com/n000dle/status/2262762147
ソース(さくらのレンタルサーバ仕様)
#!/usr/local/bin/python # -*- coding: utf-8 -*- html = '''Content-Type: text/html; charset=utf-8 <html> </body> <p>%s</p> <form action=""> <input type="text" name="text"> <input type="submit" value="post"> </form> </body> </html>''' import site site.addsitedir('外部モジュールのパス') import cgi import twitter field = cgi.FieldStorage() text = field.getfirst('text', '').decode('utf-8') txt = "Latest: " + text print html % cgi.escape(txt.encode('utf-8')) if text: api = twitter.Api('user_id','******') status = api.PostUpdate(text)