List or download a maintained custom conversion dictionary.
def get_dictionary(dictionary: str | None = None)
Description
Downloaded dictionaries can be passed directly to the custom_dict argument of countrycode.
Arguments
dictionary | Name of the dictionary to retrieve. If omitted, return the names of all available dictionaries. |
Value
A tuple of available names when dictionary is None; otherwise, a mapping of column names to values suitable for custom_dict.
Raises
ValueError | If dictionary is not one of the available names. |
urllib.error.URLError | If the remote dictionary cannot be downloaded. |
Examples
"us_states" in get_dictionary()
states = get_dictionary("us_states") # doctest: +SKIP
countrycode( # doctest: +SKIP
"MO", "state.abb", "state.name", custom_dict=states
)