Code Examples: Python
Our code examples use the Trstrank API, the most popular API on Infochimps.
infochimps-trstrank.py
#!/usr/bin/env python
import json
import urllib2
apikey = 'api_test-W1cipwpcdu9Cbd9pmm8D4Cjc469'
screen_name = 'infochimps'
url = ('http://api.infochimps.com/soc/net/tw/trstrank.json?' + 'apikey=' + apikey + '&screen_name=' + screen_name)
def main():
handle = urllib2.urlopen(url)
data = handle.read()
obj = json.loads(data)
print '%s: %f' % (screen_name, obj['trstrank'])
if __name__ == '__main__':
main()
Usage
Enter the following command into the command line to run.
python infochimps-trstrank.py
# => infochimps: 3.69686
