Skip to main content

Locode

Overview

This module contains a series of json files with ISO_3166-1, ISO_3166-2 and city codes from http://www.unece.org/cefact/locode/service/location.html

bdist_egg

python setup.py bdist_egg supports --country=<country_code> for creation of light weight eggs.

Usage

>>> import locode
>>> locode.get_country_code('United States')
u'US'
>>> locode.get_country_code('Angola')
u'AO'
>>> locode.get_country_code('Uruguay')
u'UY'
>>> locode.get_state_code('Montevideo', 'Uruguay')
u'MO'
>>> locode.get_state_code('Arizona', 'US')
u'AZ'
>>> locode.get_state_code('Saint John', 'AG')
u'04'
>>> locode.get_city_code('New York', 'NY', 'US')
u'NYC'
>>> locode.get_city_code('Punta Carretas', 'Montevideo', 'Uruguay')
u'PCA'
>>> locode.get_city_code('Ondjiva', 'Cunene', 'AO')
u'NGV'
>>> locode.get_city_code('-', '-', '-')
u'XX'
>>> locode.get_state_code('-', '-')
u'XX'
>>> locode.get_country_code('-')
u'XX'

Other methods

  • locode.get_countries() - returns a map with all countries and its codes.
  • locode.get_states(country) - returns a map with all states and its codes for the provided country.
  • locode.get_cities(country, state) - returns a map witll all cities and its codes for the provided country and state (only for few countries atm)

Release files for locode 0.1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for locode 0.1.1.1
File Size Uploaded
locode-0.1.1.1.tar.gz 920.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for locode 0.1.1.1
File Interpreter ABI Platform
locode-0.1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.5 MB

Release files / locode-0.1.1.1.tar.gz

Download URL locode-0.1.1.1.tar.gz
Size 920.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6a0e685fb639d59f0f32b8d4205493919034f41e39b42ea00143041571473b3c
BLAKE2b-256 checksum
How to use checksums
343e9a870f8461cba49fb0d5ecbb65e12a25fca467c6d42f27b3771eb75a204d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release files / locode-0.1.1.1-py3-none-any.whl

Download URL locode-0.1.1.1-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
22b3224ad7da2ec3e2c0bf06b4136cad78f5c566daca255f3e23f35af07c866a
BLAKE2b-256 checksum
How to use checksums
44f5524a1c91f73d1d320607bbd4b73b13bad9d5534a6dc3054ce53d6d40261d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.1.1 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page