Created
March 10, 2012 11:34
-
-
Save upsuper/2011199 to your computer and use it in GitHub Desktop.
a python script to monitor account of twitter
This file contains hidden or 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
#!/usr/bin/python | |
# - * - coding: UTF-8 - * - | |
import cgi | |
import json | |
import urllib | |
import httplib2 | |
h = httplib2.Http() | |
query = urllib.urlencode({ | |
'screen_name': cgi.FieldStorage()['screen_name'].value, | |
}) | |
resp, content = h.request( | |
'https://api.twitter.com/1/users/show.json?' + query) | |
data = json.loads(content) | |
print 'Content-Type: text/plain' | |
print '<pre>' | |
print 'status:%d' % (data['statuses_count'], ) | |
print 'favourite:%d' % (data['favourites_count'], ) | |
print 'friends:%d' % (data['friends_count'], ) | |
print 'followers:%d' % (data['followers_count'], ) | |
print '</pre>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment