|
|
|
|
|
|
|
|
|
|
|
|
|
|
# search for the country in the content element and display it |
|
|
# search for the country in the content element and display it |
|
|
country_code = re.search('FT=D[^\s]*\s(\w{2})', input) |
|
|
country_code = re.search('FT=D[^\s]*\s(\w{2})', input) |
|
|
country = pycountry.countries.get(alpha_2=country_code.group(1)) |
|
|
|
|
|
if country is not None: |
|
|
|
|
|
output['country'] = country |
|
|
|
|
|
else: |
|
|
|
|
|
country = pycountry.historic_countries.get(alpha_2=country_code.group(1)) |
|
|
|
|
|
|
|
|
if country_code is not None: |
|
|
|
|
|
country = pycountry.countries.get(alpha_2=country_code.group(1)) |
|
|
if country is not None: |
|
|
if country is not None: |
|
|
output['country'] = country |
|
|
output['country'] = country |
|
|
else: |
|
|
else: |
|
|
output['country'] = country_code.group(1) |
|
|
|
|
|
|
|
|
country = pycountry.historic_countries.get(alpha_2=country_code.group(1)) |
|
|
|
|
|
if country is not None: |
|
|
|
|
|
output['country'] = country |
|
|
|
|
|
else: |
|
|
|
|
|
output['country'] = country_code.group(1) |
|
|
|
|
|
|
|
|
output['raw'] = input |
|
|
output['raw'] = input |
|
|
|
|
|
|