Atem18 / isocodes

This project provides lists of various ISO standards (e.g. country, language, language scripts, and currency names) in one place
GNU Lesser General Public License v2.1
14 stars 4 forks source link

Please let lookup by common name #20

Closed hongquan closed 2 years ago

hongquan commented 2 years ago

Example:

>>> from isocodes import countries
>>> countries.get(alpha_2='VE')
{'alpha_2': 'VE', 'alpha_3': 'VEN', 'common_name': 'Venezuela', 'flag': '🇻🇪', 'name': 'Venezuela, Bolivarian Republic of', 'numeric': '862', 'official_name': 'Bolivarian Republic of Venezuela'}

>>> countries.get(common_name='Venezuela')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/quan/Works/Envs/vieperid/lib/python3.10/site-packages/isocodes/__init__.py", line 30, in get
    return [element for element in self.data if element[key] == kwargs[key]][0]
  File "/home/quan/Works/Envs/vieperid/lib/python3.10/site-packages/isocodes/__init__.py", line 30, in <listcomp>
    return [element for element in self.data if element[key] == kwargs[key]][0]
KeyError: 'common_name'

'common_name'
Atem18 commented 2 years ago

Hi @hongquan,

Thanks for the bug report. It's now fixed in the version 2022.8.2