Module exchangelib.winzone
A dict to translate from IANA location name to Windows timezone name. Translations taken from CLDR_WINZONE_URL
Functions
def generate_map(timeout=10)
-
Expand source code
def generate_map(timeout=10): """Create a new CLDR_TO_MS_TIMEZONE_MAP map from the CLDR data. Used when the CLDR database is updated. :param timeout: (Default value = 10) :return: """ r = requests.get(CLDR_WINZONE_URL, timeout=timeout) if r.status_code != 200: raise ValueError(f"Unexpected response: {r}") tz_map = {} timezones_elem = to_xml(r.content).find("windowsZones").find("mapTimezones") type_version = timezones_elem.get("typeVersion") other_version = timezones_elem.get("otherVersion") for e in timezones_elem.findall("mapZone"): for location in re.split(r"\s+", e.get("type").strip()): if e.get("territory") == DEFAULT_TERRITORY or location not in tz_map: # Prefer default territory. This is so MS_TIMEZONE_TO_IANA_MAP maps from MS timezone ID back to the # "preferred" region/location timezone name. tz_map[location] = e.get("other"), e.get("territory") return type_version, other_version, tz_map
Create a new CLDR_TO_MS_TIMEZONE_MAP map from the CLDR data. Used when the CLDR database is updated.
:param timeout: (Default value = 10) :return: