Skip to content

Instantly share code, notes, and snippets.

@jlbelmonte
Last active August 29, 2015 14:00
Show Gist options
  • Save jlbelmonte/11063439 to your computer and use it in GitHub Desktop.
Save jlbelmonte/11063439 to your computer and use it in GitHub Desktop.
apibunny
import requests
from sets import Set
_seed = 'http://apibunny.com/cells/taTKQ3Kn4KNnmwVI'
_base = 'http://apibunny.com/cells/'
visited = Set()
def processJson(json) :
cells = json.get('cells')[0]
print cells["name"]
links = cells['links']
toVisit = [ _base + links[x] for x in [k for k in links if k != "mazes"]]
map(visit, toVisit)
def visit(url):
if url in visited :
return
document = requests.get(url)
visited.add(url)
if document :
processJson(document.json());
if __name__ == "__main__":
visit(_seed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment