upsies.utils.country

Look up country information

Functions

upsies.utils.country.iso2(country)[source]

Convert fuzzy country name to ISO 3166-1 alpha-2 codes

Parameters:

country (str or sequence) – Country name or code, e.g. “Russian Federation” (official name), “USA” (common abbreviation), “Korea” (short name), “fr” (2-character country code), etc.

Returns:

Country code or country if it can’t be associated with any country

upsies.utils.country.name(country)[source]

Convert fuzzy country name to consistent name

Parameters:

country (str or sequence) – Country name or code, e.g. “Russian Federation” (official name), “USA” (common abbreviation), “Korea” (short name), “fr” (2-character country code), etc.

Returns:

Country name or country if it can’t be associated with any country

upsies.utils.country.tld(country)[source]

Convert fuzzy country name to top level domain

Parameters:

country (str or sequence) – Country name or code, e.g. “Russian Federation” (official name), “USA” (common abbreviation), “Korea” (short name), “fr” (2-character country code), etc.

Returns:

Country TLD or country if it can’t be associated with any country