Created
May 16, 2013 18:29
-
-
Save cornwe19/5593922 to your computer and use it in GitHub Desktop.
open a random set of latest viewpages on coachseye.com
This file contains 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 | |
import sys | |
import json | |
import httplib | |
from subprocess import call | |
def makerequest( count, skip ): | |
conn = httplib.HTTPConnection( "v.coachseye.com" ) | |
conn.connect() | |
conn.putrequest( "GET", "/api/v1/lists/public?top=%s&skip=%s" % ( count, skip ) ) | |
conn.endheaders() | |
return conn.getresponse() | |
def main( argv ): | |
if len( argv ) < 3: | |
print "usage %s <count> <skip>" % argv[0] | |
return | |
data = json.load( makerequest( argv[1], argv[2] ) ) | |
for item in data["Items"]: | |
call( [ "open", item["Url"] ] ) | |
if __name__ == "__main__": | |
main( sys.argv ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment