skip to navigation
skip to content

Not Logged In

pyzipcode 0.4

query zip codes and location data

Introduction

This package will allow you to get zip code information. The data used in this package is retrieved from http://pablotron.org/files/zipcodes-csv-10-Aug-2004.zip

pyzipcode uses a local sqlite database to run. You can replace it with your own other storage mechanism with a little effort.

Here is some basic usage..

>>> from pyzipcode import ZipCodeDatabase
>>> zcdb = ZipCodeDatabase()
>>> zipcode = zcdb[54115]
>>> zipcode.zip
u'54115'
>>> zipcode.city
u'De Pere'
>>> zipcode.state
u'WI'
>>> zipcode.longitude
-88.078959999999995
>>> zipcode.latitude
44.42042
>>> zipcode.timezone
-6

Search zip codes...

>>> from pyzipcode import ZipCodeDatabase
>>> zcdb = ZipCodeDatabase()
>>> len(zcdb.find_zip(city="Oshkosh"))
7

Get a list of zipcodes around a radius of a zipcode

>>> from pyzipcode import ZipCodeDatabase
>>> zcdb = ZipCodeDatabase()
>>> [z.zip for z in zcdb.get_zipcodes_around_radius('54901', 10)]
[u'54901', u'54902', u'54903', u'54904', u'54906', u'54927', u'54952', u'54956', u'54957', u'54979', u'54985']

ChangeLog

0.4

0.3

  • use strings instead of integer for storing zip codes since zip codes can start with a Zero.

0.2

  • catch sqlite db file reading errors and keep trying in case another process is trying to access the file at the same time.

0.1

  • initial release
 
File Type Py Version Uploaded on Size
pyzipcode-0.4.tar.gz (md5) Source 2010-09-06 1MB
  • Downloads (All Versions):
  • 20 downloads in the last day
  • 209 downloads in the last week
  • 949 downloads in the last month
  • Author: Nathan Van Gheem
  • Keywords: zip code distance
  • License: GPL
  • Package Index Owner: vangheem
  • DOAP record: pyzipcode-0.4.xml