Created
May 29, 2013 20:50
-
-
Save jamstooks/5673734 to your computer and use it in GitHub Desktop.
Just a quick tool I put together to output the number of people on a site using the chartbeat api and the python requests library. Useful for GeekTool and other visualization tools.
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/env python | |
""" | |
A quick tool to output the number of people on a site | |
using the chartbeat api and the python requests library | |
Useful for GeekTool and other visualization tools | |
""" | |
import requests | |
ENDPOINT_PREFIX = "http://api.chartbeat.com" | |
API_KEY = "" | |
HOST = "" | |
ENDPOINT = "/live/quickstats/v3/" | |
uri = "%s%s?apikey=%s&host=%s" % ( | |
ENDPOINT_PREFIX, ENDPOINT, API_KEY, HOST) | |
r = requests.get(uri) | |
print "%s visitors" % r.json()['people'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, you may need to use the full path to python when you are inserting the command into GeekTool because it may not be in the PATH.