Module to translate city names to time zone names
Project description
tzcity
A module to find the Olson database time zone names of some of the most populous cities in the world without an internet connection.
Only a few cities associated with each time zone are recognized to minimize the size of data bundled with the package.
Installation
You need Python>=3.6 to use tzcity.
It can be installed from PyPI with pip using
pip install tzcity
Usage
tzcity.tzcity(city: str) -> str
Accepts a city name and returns the time zone name associated with that city.
Raises ValueError
if unable to recognize city.
>>> tzcity.tzcity('abu dhabi')
'Asia/Dubai'
>>> tzcity.tzcity('bandar seri begawan')
'Asia/Brunei'
>>> tzcity.tzcity('myanmar') # a country with only one time zone
'Asia/Yangon'
tzcity.capitalize(name: str) -> str
Capitalize the city or time zone name provided as argument.
Raises ValueError
if unable to recognize name.
>>> tzcity.capitalize('andorra la vella')
'Andorra la Vella'
>>> tzcity.capitalize("new york")
'New York'
>>> tzcity.capitalize("dumont d'urville")
"Dumont d'Urville"
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
Built Distribution
File details
Details for the file tzcity-0.0.2.tar.gz
.
File metadata
- Download URL: tzcity-0.0.2.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.24.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea28529701cacb2dcb8256ae5c304dbd663cbd1f7b437d006851c126d5caecad |
|
MD5 | 3630c3a989bf3dc3eb3224b4b56b4065 |
|
BLAKE2b-256 | 94ed3cd53eac4563b03015f586bdc9b92538496fd4b38118012188115f73a99a |
Provenance
File details
Details for the file tzcity-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: tzcity-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.24.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8aaa135b4536f3bce068e35880fd88bf32dc3aed0d9f0d284048645a07406a2 |
|
MD5 | f270522bd86bf79880e57b6e5221bd80 |
|
BLAKE2b-256 | 861f495b55df4af7c2e4e4addb68b6099679e151d8a1bae6971f0dc0fac5d33b |