ThreeDigitAlphaCountryCodeToCountryName

Script for converting country names based on 3 letter Alpha codes.

python · CyCognito

Details

IDThreeDigitAlphaCountryCodeToCountryName
Languagepython
From Version6.2.0
Docker Imagedemisto/pycountry:1.0.0.10120494
Tagstransformer

README

Script for converting country names based on 3 letter Alpha codes.

Script Data


Name Description
Script Type python3
Tags transformer

Inputs


Argument Name Description
value Three digit country code

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
import pycountry
from CommonServerPython import *  # noqa: F401


def main():
    try:
        loc_names = demisto.args().get("value", [])
        names = []
        if not loc_names:
            demisto.results("")
        else:
            for location in argToList(loc_names):
                country = pycountry.countries.get(alpha_3=location)
                if country is not None:
                    names.append(country.name)
            demisto.results(names)
    except AttributeError:
        demisto.results("")
    except Exception as e:
        return_error(f"Error occurred while parsing country name:\n{e}")


if __name__ in ("__main__", "__builtin__", "builtins"):
    main()