How to use the pycountry.historic_countries.get function in pycountry

To help you get started, we鈥檝e selected a few pycountry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github indico / indico / indico / util / countries.py View on Github external
def get_country(code):
    try:
        return get_countries()[code]
    except KeyError:
        country = pycountry.historic_countries.get(alpha_2=code)
        return country.name if country else None
github indico / indico / indico / MaKaC / webinterface / common / countries.py View on Github external
def getCountryById(cls, cid):
        """
        Returns the country, given its ID
        """
        country_name = cls._countries.get(cid, None)
        if country_name:
            return country_name
        else:
            try:
                return pycountry.historic_countries.get(alpha2=cid).name.encode('utf-8')
            except KeyError:
                return None