============================================================
python-iso3166 - Standalone ISO 3166-1 country definitions
============================================================
:Authors:
Mike Spindel
:Version: 2.1.1
ISO 3166-1 defines two-letter, three-letter, and three-digit country
codes. `python-iso3166` is a self-contained module that converts
between these codes and the corresponding country name.
Installation
============
::
$ pip install iso3166
Usage
=====
Country details
---------------
::
>>> from iso3166 import countries
>>>
>>> countries.get('us')
Country(name='United States', alpha2='US', alpha3='USA', numeric='840')
>>> countries.get('ala')
Country(name='Åland Islands', alpha2='AX', alpha3='ALA', numeric='248')
>>> countries.get(8)
Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008')
Country lists and indexes
-------------------------
::
>>> from iso3166 import countries
>>> for c in countries:
print(c)
>>> Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004')
Country(name='Åland Islands', alpha2='AX', alpha3='ALA', numeric='248')
Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008')
Country(name='Algeria', alpha2='DZ', alpha3='DZA', numeric='012')
::
>>> import iso3166
>>> iso3166.countries_by_name
>>> {'AFGHANISTAN': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),
'ALBANIA': Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008'),
'ALGERIA': Country(name='Algeria', alpha2='DZ', alpha3='DZA', numeric='012'),
...
>>> iso3166.countries_by_numeric
>>> {'004': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),
'008': Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008'),
'010': Country(name='Antarctica', alpha2='AQ', alpha3='ATA', numeric='010'),
...
>>> iso3166.countries_by_alpha2
>>> {'AD': Country(name='Andorra', alpha2='AD', alpha3='AND', numeric='020'),
'AE': Country(name='United Arab Emirates', alpha2='AE', alpha3='ARE', numeric='784'),
'AF': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),
...
>>> iso3166.countries_by_alpha3
>>> {'ABW': Country(name='Aruba', alpha2='AW', alpha3='ABW', numeric='533'),
'AFG': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),
'AGO': Country(name='Angola', alpha2='AO', alpha3='AGO', numeric='024'),
...
Changes
=======
2.1.1 - July 11, 2022
---------------------
* Move install metadata from ``setup.py`` to ``setup.cfg``
* Add py.typed to source distribution
2.1.0 - July 11, 2022
---------------------
* Updated entries
- "Turkey" changed to "Türkiye"
2.0.2 - Sep 20, 2021
--------------------
* Add the ``py.typed`` marker file in accordance with PEP 561
2.0.1 - Sep 14, 2021
--------------------
* Add ``python_requires`` to ``setup.py``
2.0.0 - Sep 14, 2021
--------------------
* Add type hints throughout codebase (thanks blokje!)
* Drop support for Python versions prior to 3.6
1.0.1 - Dec 13, 2019
--------------------
* Include test files in source distribution (thanks pmosetc!)
* Added all Python 3 versions to tox.ini and supported list
1.0 - March 19, 2018
--------------------
* Updated entries
- "Macedonia, the former Yugoslav Republic of" changed to "North
Macedonia" (effective 2019-03-13)
- Added numeric code 983 for Kosovo to mirror usage by the National
Statistical Office of Canada (thanks betaboon!)
0.9 - July 21, 2018
-------------------
* Updated entries
- New entry for Kosovo (XK / XKX)
- Swaziland changed to Eswatini (effective 2018-07-16)
0.8 - February 5, 2017
-----------------------
* Updated entries
- Czechia (changed 2016-09)
- United Kingdom of Great Britain and Northern Ireland (changed
2014-12)
0.7 - February 13, 2015
-----------------------
* Added new attribute ``apolitical_name`` to Country. This field
reflects the ISO short name but has unnecessarily inflammatory
modifiers removed.
Specifically: "Taiwan, Province of China" maps to "Taiwan" and
"Palestine, State of" maps to "Palestine."
* Updated entries
- Holy See (changed in 2014-12)
* CountryLookup now raises KeyError when passed an unknown integer
rather than AttributeError. (thanks unsignedint!)
0.6 - September 28, 2014
------------------------
* Updated entries
- Cabo Verde (changed in 2013-11)
* Documented the dictionaries used for looking up countries by alpha2,
etc. (thanks brunetton!)
0.5 - February 13, 2014
-----------------------
* Added ``__contains__`` to CountryLookup (thanks tomako!)
* Current through ISO newsletter VI-16
- No changes needed
0.4 - February 14, 2013
-----------------------
* Current through ISO newsletter VI-14
* Updated entries
- Palestine
0.3 - September 4, 2012
-----------------------
* Current through ISO newsletter VI-13
* Fix changes from 0.2 (thanks vincentfretin!):
- Venezuela
- Saint Helena
- Bolivia
0.2 - March 26, 2012
--------------------
* Current through ISO newsletter VI-12
* Added missing entry for Afghanistan
* Updated entries
- Bolivia (ISO Newsletter VI-6)
- Libya (VI-11)
- Saint Helena (VI-7)
- Sudan (VI-10)
- Venezuela (VI-5)
* New entries:
- Bonaire, Sint Eustatius and Saba (VI-8)
- Curaçao (VI-8)
- Sint Maarten (Dutch part) (VI-8)
- South Sudan (VI-10)
* Deleted entries:
- Netherlands Antilles (VI-8)
0.1 - December 14, 2010
-----------------------
* Initial release
Raw data
{
"_id": null,
"home_page": "http://github.com/deactivated/python-iso3166",
"name": "iso3166",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "iso 3166-1,country codes",
"author": "Mike Spindel",
"author_email": "mike@spindel.is",
"download_url": "https://files.pythonhosted.org/packages/5c/11/b5023c736a185a88ebd0d38646af6f4d1b4c9b91f2ca84e08e5d2bc7ac3c/iso3166-2.1.1.tar.gz",
"platform": null,
"description": "============================================================\n python-iso3166 - Standalone ISO 3166-1 country definitions\n============================================================\n\n:Authors:\n Mike Spindel\n:Version: 2.1.1\n\n\nISO 3166-1 defines two-letter, three-letter, and three-digit country\ncodes. `python-iso3166` is a self-contained module that converts\nbetween these codes and the corresponding country name.\n\n\nInstallation\n============\n\n::\n\n $ pip install iso3166\n\n\nUsage\n=====\n\nCountry details\n---------------\n\n::\n\n >>> from iso3166 import countries\n >>>\n >>> countries.get('us')\n Country(name='United States', alpha2='US', alpha3='USA', numeric='840')\n >>> countries.get('ala')\n Country(name='\u00c5land Islands', alpha2='AX', alpha3='ALA', numeric='248')\n >>> countries.get(8)\n Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008')\n\n\nCountry lists and indexes\n-------------------------\n\n::\n\n >>> from iso3166 import countries\n\n >>> for c in countries:\n print(c)\n >>> Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004')\n Country(name='\u00c5land Islands', alpha2='AX', alpha3='ALA', numeric='248')\n Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008')\n Country(name='Algeria', alpha2='DZ', alpha3='DZA', numeric='012')\n\n::\n\n >>> import iso3166\n\n >>> iso3166.countries_by_name\n >>> {'AFGHANISTAN': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),\n 'ALBANIA': Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008'),\n 'ALGERIA': Country(name='Algeria', alpha2='DZ', alpha3='DZA', numeric='012'),\n ...\n\n >>> iso3166.countries_by_numeric\n >>> {'004': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),\n '008': Country(name='Albania', alpha2='AL', alpha3='ALB', numeric='008'),\n '010': Country(name='Antarctica', alpha2='AQ', alpha3='ATA', numeric='010'),\n ...\n\n >>> iso3166.countries_by_alpha2\n >>> {'AD': Country(name='Andorra', alpha2='AD', alpha3='AND', numeric='020'),\n 'AE': Country(name='United Arab Emirates', alpha2='AE', alpha3='ARE', numeric='784'),\n 'AF': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),\n ...\n\n >>> iso3166.countries_by_alpha3\n >>> {'ABW': Country(name='Aruba', alpha2='AW', alpha3='ABW', numeric='533'),\n 'AFG': Country(name='Afghanistan', alpha2='AF', alpha3='AFG', numeric='004'),\n 'AGO': Country(name='Angola', alpha2='AO', alpha3='AGO', numeric='024'),\n ...\n\nChanges\n=======\n\n2.1.1 - July 11, 2022\n---------------------\n\n* Move install metadata from ``setup.py`` to ``setup.cfg``\n* Add py.typed to source distribution\n\n2.1.0 - July 11, 2022\n---------------------\n\n* Updated entries\n\n - \"Turkey\" changed to \"T\u00fcrkiye\"\n\n2.0.2 - Sep 20, 2021\n--------------------\n\n* Add the ``py.typed`` marker file in accordance with PEP 561\n\n2.0.1 - Sep 14, 2021\n--------------------\n\n* Add ``python_requires`` to ``setup.py``\n\n2.0.0 - Sep 14, 2021\n--------------------\n\n* Add type hints throughout codebase (thanks blokje!)\n\n* Drop support for Python versions prior to 3.6\n\n1.0.1 - Dec 13, 2019\n--------------------\n\n* Include test files in source distribution (thanks pmosetc!)\n\n* Added all Python 3 versions to tox.ini and supported list\n\n1.0 - March 19, 2018\n--------------------\n\n* Updated entries\n\n - \"Macedonia, the former Yugoslav Republic of\" changed to \"North\n Macedonia\" (effective 2019-03-13)\n\n - Added numeric code 983 for Kosovo to mirror usage by the National\n Statistical Office of Canada (thanks betaboon!)\n\n0.9 - July 21, 2018\n-------------------\n\n* Updated entries\n\n - New entry for Kosovo (XK / XKX)\n\n - Swaziland changed to Eswatini (effective 2018-07-16)\n\n0.8 - February 5, 2017\n-----------------------\n\n* Updated entries\n\n - Czechia (changed 2016-09)\n\n - United Kingdom of Great Britain and Northern Ireland (changed\n 2014-12)\n\n0.7 - February 13, 2015\n-----------------------\n\n* Added new attribute ``apolitical_name`` to Country. This field\n reflects the ISO short name but has unnecessarily inflammatory\n modifiers removed.\n\n Specifically: \"Taiwan, Province of China\" maps to \"Taiwan\" and\n \"Palestine, State of\" maps to \"Palestine.\"\n\n* Updated entries\n\n - Holy See (changed in 2014-12)\n\n* CountryLookup now raises KeyError when passed an unknown integer\n rather than AttributeError. (thanks unsignedint!)\n\n0.6 - September 28, 2014\n------------------------\n\n* Updated entries\n - Cabo Verde (changed in 2013-11)\n\n* Documented the dictionaries used for looking up countries by alpha2,\n etc. (thanks brunetton!)\n\n0.5 - February 13, 2014\n-----------------------\n\n* Added ``__contains__`` to CountryLookup (thanks tomako!)\n\n* Current through ISO newsletter VI-16\n - No changes needed\n\n0.4 - February 14, 2013\n-----------------------\n\n* Current through ISO newsletter VI-14\n\n* Updated entries\n - Palestine\n\n0.3 - September 4, 2012\n-----------------------\n\n* Current through ISO newsletter VI-13\n\n* Fix changes from 0.2 (thanks vincentfretin!):\n\n - Venezuela\n\n - Saint Helena\n\n - Bolivia\n\n0.2 - March 26, 2012\n--------------------\n\n* Current through ISO newsletter VI-12\n\n* Added missing entry for Afghanistan\n\n* Updated entries\n\n - Bolivia (ISO Newsletter VI-6)\n\n - Libya (VI-11)\n\n - Saint Helena (VI-7)\n\n - Sudan (VI-10)\n\n - Venezuela (VI-5)\n\n* New entries:\n\n - Bonaire, Sint Eustatius and Saba (VI-8)\n\n - Cura\u00e7ao (VI-8)\n\n - Sint Maarten (Dutch part) (VI-8)\n\n - South Sudan (VI-10)\n\n* Deleted entries:\n\n - Netherlands Antilles (VI-8)\n\n\n0.1 - December 14, 2010\n-----------------------\n\n* Initial release\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Self-contained ISO 3166-1 country definitions.",
"version": "2.1.1",
"split_keywords": [
"iso 3166-1",
"country codes"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "a1ce018f651890df8b7ef9551cf4c978",
"sha256": "263660b36f8471c42acd1ff673d28a3715edbce7d24b1550d0cf010f6816c47f"
},
"downloads": -1,
"filename": "iso3166-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a1ce018f651890df8b7ef9551cf4c978",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 9829,
"upload_time": "2022-07-12T04:07:55",
"upload_time_iso_8601": "2022-07-12T04:07:55.540437Z",
"url": "https://files.pythonhosted.org/packages/08/d0/bf18725b8d47f37858ff801f8e4d40c6982730a899725bdb6ded62199954/iso3166-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "b1661b2e68fea5a248d02ef00e59c369",
"sha256": "fcd551b8dda66b44e9f9e6d6bbbee3a1145a22447c0a556e5d0fb1ad1e491719"
},
"downloads": -1,
"filename": "iso3166-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "b1661b2e68fea5a248d02ef00e59c369",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 12807,
"upload_time": "2022-07-12T04:07:57",
"upload_time_iso_8601": "2022-07-12T04:07:57.294094Z",
"url": "https://files.pythonhosted.org/packages/5c/11/b5023c736a185a88ebd0d38646af6f4d1b4c9b91f2ca84e08e5d2bc7ac3c/iso3166-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-07-12 04:07:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "deactivated",
"github_project": "python-iso3166",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "iso3166"
}