Country and city codes from around the world.
Project description
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)
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
locode-0.1.1.1.tar.gz
(920.3 kB
view details)
Built Distribution
File details
Details for the file locode-0.1.1.1.tar.gz
.
File metadata
- Download URL: locode-0.1.1.1.tar.gz
- Upload date:
- Size: 920.3 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a0e685fb639d59f0f32b8d4205493919034f41e39b42ea00143041571473b3c |
|
MD5 | 4822c5bd49245946e76f1c7f699ea6df |
|
BLAKE2b-256 | 343e9a870f8461cba49fb0d5ecbb65e12a25fca467c6d42f27b3771eb75a204d |
File details
Details for the file locode-0.1.1.1-py3-none-any.whl
.
File metadata
- Download URL: locode-0.1.1.1-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22b3224ad7da2ec3e2c0bf06b4136cad78f5c566daca255f3e23f35af07c866a |
|
MD5 | 4a138ff9606ceb057f35f96bb09844a6 |
|
BLAKE2b-256 | 44f5524a1c91f73d1d320607bbd4b73b13bad9d5534a6dc3054ce53d6d40261d |