Script to obtain current list of zip codes, cities, and states from public sources on the Internet
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



getzips is a simple project to get an up-to-date list of all zip codes with corresponding cities and states from publicly available sources on the internet (specifically, the USPS website). It operates by downloading (or "spidering") the response pages for the USPS zip code search for all possible 5-digit codes (00000 to 99999). The pages are then parsed to extract city and state information.


To get fairly recent zip codes, cities and states, simply Download zips.csv.

To run your own spidering operation and get the very latest results:

$ python

Please note that this will take some time (probably more than 24 hours, depending on the speed of your computer and Internet connection). The script limits the speed of its requests using the request_delay variable (set at the top of the script), in order to play nice with USPS.

If you obtain more current results, please submit a pull request with the updated zips.csv, so that we can all get the latest results here.

dependencies depends on: