geotz v0.0.2b0

GitHub repository

This is a simple, lightweight library designed for fast and easy lookup of time zones based on country code and postal code or postal code prefix.

It leverages offline data from www.geonames.org to determine the approximate location and convert it into a time zone, all without the need for network requests or external APIs.

Contents:

Introduction

Geotz aims to provide a straightforward and efficient solution for applications requiring time zone data.

It is less feature-rich but easier to use and lighter than alternatives such as geopy or pgeocode.

Features include:

  • No API Key Required: No need to manage API keys or external API services.

  • Offline Functionality: Performs all operations offline.

  • Bundled Data: Comes packaged with all necessary geographical data.

  • On-Demand Data Loading: Loads data as needed to minimize memory usage.

  • Minimal Dependencies: Keeps additional dependencies to a minimum.

Getting Started

To get started with geotz, see the Installation section, followed by the Usage guide to see how to implement geotz in your projects.

Limitations

Some countries are not supported, and there are no guarantees that every postal code will be found.

Some timezones may be inaccurate, particularly around timezone borders. Hopefully the differences are off by no more than an hour.

Here are some details about supported and unsupported locations:

geotz.SUPPORTED_COUNTRY_CODES = ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'ML', 'MM', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'US', 'UY', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW']

ISO 3166-1 alpha-2 codes that should be supported if the optional pytz dependency is installed. It will be fewer countries otherwise.

geotz.UNSUPPORTED_COUNTRY_CODES = ['AQ', 'BV', 'CD', 'HM', 'ID', 'KI', 'KZ', 'MN', 'PG', 'PS', 'UM', 'UZ']

ISO 3166-1 alpha-2 codes that are not supported if the optional pytz dependency is installed. It will be more countries otherwise.

geotz.UNSUPPORTED_LOCATIONS = ['Antarctica', 'Bouvet Island', 'Congo (Dem. Rep.)', 'Heard Island & McDonald Islands', 'Indonesia', 'Kiribati', 'Kazakhstan', 'Mongolia', 'Papua New Guinea', 'Palestine', 'US minor outlying islands', 'Uzbekistan']

Countries, territories or areas of interest not supported if the optional pytz dependency is installed. It will be more locations otherwise.

Indices and tables