Use HTTP_OK constant (#33798)

* Use http ok constant

* Remove incorrect use

* Run isort

* Fix pylint by adding missing imports

* Fix pylint by fixing one import
This commit is contained in:
springstan 2020-04-08 18:47:38 +02:00 committed by GitHub
parent 7383e81609
commit 8d61893c39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 214 additions and 154 deletions

View file

@ -3,7 +3,7 @@
import logging
from typing import Optional
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, HTTP_OK
from .const import (
KEY_DEVICES,
@ -40,12 +40,12 @@ class RachioPerson:
def setup(self, hass):
"""Rachio device setup."""
response = self.rachio.person.getInfo()
assert int(response[0][KEY_STATUS]) == 200, "API key error"
assert int(response[0][KEY_STATUS]) == HTTP_OK, "API key error"
self._id = response[1][KEY_ID]
# Use user ID to get user data
data = self.rachio.person.get(self._id)
assert int(data[0][KEY_STATUS]) == 200, "User ID error"
assert int(data[0][KEY_STATUS]) == HTTP_OK, "User ID error"
self.username = data[1][KEY_USERNAME]
devices = data[1][KEY_DEVICES]
for controller in devices: