Remove geo ip (#586)

* Remove geo ip

* Update core.py

* Update dt.py
This commit is contained in:
Pascal Vizeli 2018-07-21 19:45:11 +02:00 committed by GitHub
parent fa9e20385e
commit e3ae48c8ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 25 deletions

View File

@ -7,7 +7,6 @@ from .coresys import CoreSysAttributes
from .const import ( from .const import (
STARTUP_SYSTEM, STARTUP_SERVICES, STARTUP_APPLICATION, STARTUP_INITIALIZE) STARTUP_SYSTEM, STARTUP_SERVICES, STARTUP_APPLICATION, STARTUP_INITIALIZE)
from .exceptions import HassioError from .exceptions import HassioError
from .utils.dt import fetch_timezone
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -21,12 +20,6 @@ class HassIO(CoreSysAttributes):
async def setup(self): async def setup(self):
"""Setup HassIO orchestration.""" """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 # Load Supervisor
await self.sys_supervisor.load() await self.sys_supervisor.load()

View File

@ -1,10 +1,8 @@
"""Tools file for HassIO.""" """Tools file for HassIO."""
import asyncio
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
import logging import logging
import re import re
import aiohttp
import pytz import pytz
UTC = pytz.utc 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. # Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved. # All rights reserved.
# https://github.com/django/django/blob/master/LICENSE # https://github.com/django/django/blob/master/LICENSE