Created
December 23, 2011 21:59
-
-
Save jweinstein/1515470 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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