Skip to content

Instantly share code, notes, and snippets.

@jweinstein
Created December 23, 2011 21:59
Show Gist options
  • Select an option

  • Save jweinstein/1515470 to your computer and use it in GitHub Desktop.

Select an option

Save jweinstein/1515470 to your computer and use it in GitHub Desktop.
from hyperpublic import *
...
for zip in zipcodes:
inserted = 0
notinserted = 0
for p in range(1,rounds + 1):
try:
items = hp.places.find(location=str(zip),q="pizza", page = p, page_size = 50)
except:
break
for item in items:
try:
dbh.nypizza.insert(item, safe = True)
inserted += 1;
except DuplicateKeyError:
notinserted += 1
print "%d items inserted and %d duplicates found for zipcode %d" % (inserted, notinserted, zip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment