Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

query zip codes and location data

Project description


This package will allow you to get zip code information. The data used in this package is retrieved from

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]
u'De Pere'
>>> zipcode.state
>>> zipcode.longitude
>>> zipcode.latitude
>>> zipcode.timezone

Search zip codes…

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

Get a list of zipcodes around a radius of a zipcode

>>> from pyzipcode import ZipCodeDatabase
>>> zcdb = ZipCodeDatabase()
>>> [ 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']


1.0 (2016-01-20)

  • Fix import code so that it is not run when the module is imported (for example, when building Sphinx API Documentation).
  • Rename the module to because import is a reserved Python keyword.
  • Document the import_zipcode module.



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


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


  • initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyzipcode, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size (1.9 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page