This is a catalogue that gives you information about any country chosen.
The default source is the Country Code. This is the list of all country facts. It can be downloaded here: country-codes.csv. The catalogue can use different sources as long as the format is the same.
You can install directly after cloning:
$ python setup.py install --userOr use the Python package:
$ pip install --user country_catalogueAfter installation, you should have country_catalogue in your $PATH:
Create once the currency converter object:
>>> from country_catalogue.country import CountryCatalogue
>>> cc = CountryCatalogue()Convert from EUR to USD using the last available rate:
>>> cc.get_country_info(name="nigeria") # doctest: +SKIP
>>> print(cc.english_formal_name)
Nigeriaget_country_info returns an instance of SimpleNamespace which supports .(dot) notation:
english_formal_nameCLDR_display_nameofficial_namelets you know the name of the countryISO3166_1_Alpha_3ISO3166_1_Alpha_2official_namelets you on some geos data
>>> cc.ISO3166_1_Alpha_3
>>> cc.ISO3166_1_Alpha_2currencycapitalandcontinentis also available
Finally, you can use other attributes to get around:
# Load the packaged data and reference ISO3166-1-Alpha-2 code
cc = CountryCatalogue()
cc.get_country_info(alpha2="NG")
# reference ISO3166-1-Alpha-3 code is also available
cc.get_country_info(alpha2="NIG")#geoname_id
# lastly you can refernece by geoname_id
cc.get_country_info(geoname_id="234567")Tables are available based on Currency used by any country or Continent that a country belongs to.
>>> from country_catalogue.country import CountryCatalogue
>>> cc = CountryCatalogue()
# Full name of currency can be used
>>> cc.get_currency_table(full_name="Naira")
# short_code can be used "numeric_code"
>>> cc.get_currency_table(short_code="NGN")
# numeric_code can be used aswell
>>> cc.get_currency_table(numeric_code=2)
# continent table, just takes the name of the company
>>> cc.get_continent_table("Africa)