From e3ae48c8ff1bc52e26c4e3081575e296760f9200 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 21 Jul 2018 19:45:11 +0200 Subject: [PATCH] Remove geo ip (#586) * Remove geo ip * Update core.py * Update dt.py --- hassio/core.py | 7 ------- hassio/utils/dt.py | 18 ------------------ 2 files changed, 25 deletions(-) diff --git a/hassio/core.py b/hassio/core.py index 94c845965..ad99bad35 100644 --- a/hassio/core.py +++ b/hassio/core.py @@ -7,7 +7,6 @@ from .coresys import CoreSysAttributes from .const import ( STARTUP_SYSTEM, STARTUP_SERVICES, STARTUP_APPLICATION, STARTUP_INITIALIZE) from .exceptions import HassioError -from .utils.dt import fetch_timezone _LOGGER = logging.getLogger(__name__) @@ -21,12 +20,6 @@ class HassIO(CoreSysAttributes): async def setup(self): """Setup HassIO orchestration.""" - # update timezone - if self.sys_config.timezone == 'UTC': - self.sys_config.timezone = \ - await fetch_timezone(self.sys_websession) - self.sys_loop.call_soon(self.sys_config.save_data) - # Load Supervisor await self.sys_supervisor.load() diff --git a/hassio/utils/dt.py b/hassio/utils/dt.py index 5415f80b0..c5ff11316 100644 --- a/hassio/utils/dt.py +++ b/hassio/utils/dt.py @@ -1,10 +1,8 @@ """Tools file for HassIO.""" -import asyncio from datetime import datetime, timedelta, timezone import logging import re -import aiohttp import pytz UTC = pytz.utc @@ -24,22 +22,6 @@ DATETIME_RE = re.compile( ) -async def fetch_timezone(websession): - """Read timezone from freegeoip.""" - data = {} - try: - async with websession.get(FREEGEOIP_URL, timeout=10) as request: - data = await request.json() - - except (aiohttp.ClientError, asyncio.TimeoutError) as err: - _LOGGER.warning("Can't fetch freegeoip data: %s", err) - - except ValueError as err: - _LOGGER.warning("Error on parse freegeoip data: %s", err) - - return data.get('time_zone', 'UTC') - - # Copyright (c) Django Software Foundation and individual contributors. # All rights reserved. # https://github.com/django/django/blob/master/LICENSE