Skip to content
Snippets Groups Projects
Unverified Commit a7382c80 authored by Cliffano Subagio's avatar Cliffano Subagio Committed by GitHub
Browse files

Fix KeyError when Twitter app permission is set to Read (#60018)

parent 3b5a7d00
No related branches found
No related tags found
No related merge requests found
......@@ -243,7 +243,12 @@ class TwitterNotificationService(BaseNotificationService):
def log_error_resp(resp):
"""Log error response."""
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)
@staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment