diff --git a/pyproject.toml b/pyproject.toml index 3a9c80f..5a39886 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "tracarbon" authors = ["Florian Valeye "] -version = "0.6.1" +version = "0.6.2" description = "Tracarbon is a Python library that tracks your device's energy consumption and calculates your carbon emissions." readme = "README.md" license = "Apache-2.0" diff --git a/tracarbon/locations/country.py b/tracarbon/locations/country.py index 7e0f69f..294c9c0 100644 --- a/tracarbon/locations/country.py +++ b/tracarbon/locations/country.py @@ -35,7 +35,7 @@ def from_eu_file(cls, country_code_alpha_iso_2: str) -> "Country": with open(str(resource)) as json_file: countries_values = ujson.load(json_file)["countries"] for country in countries_values: - if country_code_alpha_iso_2 == country["name"]: + if country_code_alpha_iso_2.lower() == country["name"]: return cls.parse_obj(country) raise CountryIsMissing( f"The country [{country_code_alpha_iso_2}] is not in the co2 emission file." @@ -56,7 +56,7 @@ def get_current_country( logger.debug(f"Send request to this url: {url}, timeout {timeout}s") text = requests.get(url, timeout=timeout).text content_json = ujson.loads(text) - return content_json["country"].lower() + return content_json["country"] except Exception as exception: logger.error(f"Failed to request this url: {url}") raise exception