Use xml.etree through defusedxml (#19640)

This commit is contained in:
Ville Skyttä authored and Fabian Affolter committed 2018-12-30 00:07:48 +01:00
1 parent 32eb4e518b
commit f925d9ca6b
5 files changed
+17 -5

No files matched your search

@@ -6,7 +6,6 @@ https://home-assistant.io/components/sensor.ohmconnect/
"""
import logging
from datetime import timedelta
import xml.etree.ElementTree as ET
import requests
import voluptuous as vol
@@ -17,6 +16,8 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['defusedxml==0.5.0']
_LOGGER = logging.getLogger(__name__)
CONF_ID = 'id'
@@ -68,6 +69,8 @@ class OhmconnectSensor(Entity):
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest data from OhmConnect."""
import defusedxml.ElementTree as ET
try:
url = ("https://login.ohmconnect.com"
"/verify-ohm-hour/{}").format(self._ohmid)