nokey.country_info package

Submodules

nokey.country_info.rest_country module

class nokey.country_info.rest_country.RestCountries(use_caching=False, cache_name='rest_country_cache', backend='sqlite', expire_after=3600)[source]

Bases: object

A class to interact with the RestCountries API.

base_url

The base URL of the RestCountries API.

about

A short description of the API.

get_all_countries()[source]

Returns information about all countries listed in the API.

Parameters:

None

Returns:

A list of dictionaries containing information about all the countries, or an error if no data is found.

Return type:

list

get_country_by_capital(capital)[source]

Returns information about a country with the given capital

Parameters:

capital (str) – The name of the capital city.

Returns:

A list of dictionaries containing information about countries using the capital, or an error if no countries found.

Return type:

list

get_country_by_code(code)[source]

Returns information about a country by its code (cca2, ccn3, cca3, or cioc).

Parameters:

code (str) – The country code.

Returns:

Information about the country, or an error if country not found.

Return type:

dict

get_country_by_currency(currency)[source]

Returns information about countries that use a specific currency.

Parameters:

currency (str) – The currency code or name.

Returns:

A list of dictionaries containing information about countries using the currency, or an error if no countries found.

Return type:

list

get_country_by_language(language)[source]

Returns information about countries speaking a given language.

Parameters:

language (str) – The name of the spoken language of the country.

Returns:

A list of dictionaries containing information about countries using the language, or an error if no countries found.

Return type:

list

get_country_by_name(name)[source]

Returns information about a country by its name.

Parameters:

name (str) – The name of the country.

Returns:

Information about the country, or an error if country not found.

Return type:

dict

get_country_by_region(region)[source]

Returns information about countries based on a given region.

Parameters:

region (str) – The name of the region.

Returns:

A list of dictionaries containing information about countries using the region, or an error if no country is found.

Return type:

list

get_country_by_subregion(subregion)[source]

Returns information about countries based on a given subregion.

Parameters:

subregion (str) – The name of the subregion.

Returns:

A list of dictionaries containing information about countries using the region, or an error if no country is found.

Return type:

list

get_country_by_translation(translation)[source]

Returns information about countries based on a translation of the name.

Parameters:

translation (str) – The name in a given translation.

Returns:

A list of dictionaries containing information about countries using the region, or an error if no country is found.

Return type:

list

get_docs_url()[source]

Returns url for API docs.

Parameters:

None

Returns:

Url for the API documentation.

Return type:

string

Module contents