Skip to content

Instantly share code, notes, and snippets.

@cornwe19
Created May 16, 2013 18:29
Show Gist options
  • Save cornwe19/5593922 to your computer and use it in GitHub Desktop.
Save cornwe19/5593922 to your computer and use it in GitHub Desktop.
open a random set of latest viewpages on coachseye.com
#!/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