A package to convert ZIP codes to time zones and get geographic coordinates.
Project description
This is a python package with US Zip Code convenience functions such as those listed in the examples below. It uses the geonames data, coupled with the timezonefinder package. It uses a mapping of the popular timezone regions in US, and returns the outputs accordingly. Latest release includes dependency fixes and documentation updates.
Quick Guide:
pip install ziptimezone
import ziptimezone as zpt
# returns a tuple (42.377, -71.1256)
zpt.get_lat_long_for_zip('02138')
# returns 'Eastern' the timezone has been reduced to the more popular zones
# for United States Regions
zpt.get_timezone_by_zip('02138')
# returns a dictionary, {'02138': 'Eastern', '85260': 'Mountain'}
zpt.get_timezone_for_many_zips(['02138', '85260'])
# returns a string, '02138 is ahead of 72201 by 1.00 hours."}
zpt.calculate_time_difference(['02138', '72201'])
# returns a dictionary, for 5/30/24 {'sunrise_time': '05:11:13', 'sunset_time': '20:13:31'}
today_sun_times = get_sunrise_sunset("02138")
# Get sunrise and sunset times for ZIP code 02138 on July 4, 2024
# will return {'sunrise_time': '05:13:42', 'sunset_time': '20:24:10'}
july4_sun_times = get_sunrise_sunset("02138", datetime(2024, 7, 4).date())
For more refer to the Documentation.
Also check:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ziptimezone-1.1.7.tar.gz
(8.0 kB
view details)
Built Distribution
File details
Details for the file ziptimezone-1.1.7.tar.gz
.
File metadata
- Download URL: ziptimezone-1.1.7.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e9e8b55a641295d3d91e4cde3a73985310b36607708ee0e50b920992b2d9dee |
|
MD5 | 2ce003deedb63707925702c4b2f1a642 |
|
BLAKE2b-256 | 4d59864a0dac7139bdfaa7fc5e7111d1bc2d296e1a8e143eef443516154144fa |
File details
Details for the file ziptimezone-1.1.7-py3-none-any.whl
.
File metadata
- Download URL: ziptimezone-1.1.7-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec9b7536f4396a87e751f6f3ac3569a4cfac97cda853b75b67523ec8fcb5b631 |
|
MD5 | df006f16f6d2da8d89704a361d6d9d98 |
|
BLAKE2b-256 | 3433d09dd23432b54dd2754f0090e1e5f0bc2b4fcc56583ece26d98cbef0e96c |