Use http status constants more, add HTTP_ACCEPTED and HTTP_BAD_GATEWAY (#39993)
* Use http status codes and add HTTP_BAD_GATEWAY constant * Address review comments: - using constants in tado integration - using constant in media_player init.py * Add and use HTTP_ACCEPTED constant
This commit is contained in:
1 parent
59d610af17
commit
db582bdc1b
32 files changed
+137
-58
No files matched your search
@@ -17,6 +17,7 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
HTTP_OK,
|
||||
HTTP_UNAUTHORIZED,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
@@ -155,7 +156,7 @@ class DdWrtDeviceScanner(DeviceScanner):
|
||||
return
|
||||
if response.status_code == HTTP_OK:
|
||||
return _parse_ddwrt_response(response.text)
|
||||
if response.status_code == 401:
|
||||
if response.status_code == HTTP_UNAUTHORIZED:
|
||||
# Authentication error
|
||||
_LOGGER.exception(
|
||||
"Failed to authenticate, check your username and password"
|
||||
|
||||
Reference in new issue
Block a user