twitter の API 制限が揺るくなった気がする
yoshiori@yoshiori-ubuntu $ cat twlimit.py #!/usr/bin/env python # -*- coding: utf-8 -*- import simplejson, urllib2 from pit import Pit if __name__ =='__main__': twitter_config = Pit.get('twitter.com',{'require' : { 'user' : 'Your twitter name', 'password' : 'Your twitter password'}}) passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, 'http://twitter.com/', twitter_config['user'], twitter_config['password']) authhandler = urllib2.HTTPBasicAuthHandler(passman) opener = urllib2.build_opener(authhandler) opener.addheaders = [('User-agent', 'TwitterTest(yoshiori@gmail.com)')] print simplejson.load( opener.open('http://twitter.com/account/rate_limit_status.json')) yoshiori@yoshiori-ubuntu $ python twlimit.py {u'reset_time': u'Mon Oct 12 10:35:01 +0000 2009', u'remaining_hits': 19997, u'reset_time_in_seconds': 1255343701, u'hourly_limit': 20000}
あとで綺麗に書くかも