From dda3a1317e323db3dacd5b2c77c309d3706d1813 Mon Sep 17 00:00:00 2001 From: Herminio Vazquez Date: Sun, 28 Jan 2024 13:25:00 +0100 Subject: [PATCH] Removed pandas XML dependency on countries download --- cuallee/iso/checks.py | 7 ++----- pyproject.toml | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cuallee/iso/checks.py b/cuallee/iso/checks.py index 1d3a7bb0..5a5eff64 100644 --- a/cuallee/iso/checks.py +++ b/cuallee/iso/checks.py @@ -7,6 +7,7 @@ from functools import lru_cache import pandas as pd from toolz import first +from i18n_iso_countries import get_alpha2_codes @dataclass @@ -35,11 +36,7 @@ def _get_ccy(element): @lru_cache def _load_countries(): """External download from Google shared data of country codes and locations""" - DEFAULT_ENDPOINT_3166 = ( - "https://developers.google.com/public-data/docs/canonical/countries_csv" - ) - response = pd.read_html(os.getenv("ISO_3166_ENDPOINT", DEFAULT_ENDPOINT_3166)) - return first(response)["country"].str.upper().dropna().tolist() + return list(get_alpha2_codes().values()) class ISO: diff --git a/pyproject.toml b/pyproject.toml index 94a750ca..35ae2b2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,8 @@ dependencies = [ "toolz >= 0.12.0", "pygments >= 2.15.1", "requests >= 2.28.2", - "pandas>=1.5.3" + "pandas>=1.5.3", + "i18n-iso-countries==1.0.0", ] [project.optional-dependencies]