mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 04:35:11 +02:00
Fix KeyError when Twitter app permission is set to Read (#60018)
This commit is contained in:
@@ -243,7 +243,12 @@ class TwitterNotificationService(BaseNotificationService):
|
|||||||
def log_error_resp(resp):
|
def log_error_resp(resp):
|
||||||
"""Log error response."""
|
"""Log error response."""
|
||||||
obj = json.loads(resp.text)
|
obj = json.loads(resp.text)
|
||||||
error_message = obj["errors"]
|
if "errors" in obj:
|
||||||
|
error_message = obj["errors"]
|
||||||
|
elif "error" in obj:
|
||||||
|
error_message = obj["error"]
|
||||||
|
else:
|
||||||
|
error_message = resp.text
|
||||||
_LOGGER.error("Error %s: %s", resp.status_code, error_message)
|
_LOGGER.error("Error %s: %s", resp.status_code, error_message)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Reference in New Issue
Block a user