Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (22 sloc) 751 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
import scraperwiki.sqlite as db
PARENT_ID = 2511# London Borough of Haringey
def iter_children_areas_kml(parent_id):
children = getjs('' % parent_id)
for id, data in children.items():
kml = requests.get('' % id).content
entry = {'parent_area': int(data['parent_area']),
'id': int(id),
'name': data['name'],
'kml': kml}
yield entry
def getjs(url, **opts):
return json.loads(requests.get(url, **opts).content)
# Main
data = list(iter_children_areas_kml(PARENT_ID))['id'], data, verbose=0)