From 10c0744c4a30b65cb8f8e1e1bc42701a97fc24b0 Mon Sep 17 00:00:00 2001 From: Mike Christianson Date: Mon, 11 Sep 2017 21:37:36 -0700 Subject: [PATCH] Fixes #9353 (#9354) Follow [Twitter's guidance](https://dev.twitter.com/rest/reference/post/media/upload-finalize) for media uploads: "If and (only if) the response of the FINALIZE command contains a processing_info field, it may also be necessary to use a STATUS command and wait for it to return success before proceeding to Tweet creation." --- homeassistant/components/notify/twitter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/notify/twitter.py b/homeassistant/components/notify/twitter.py index 25e6fc00a2f..d4e969e95ec 100644 --- a/homeassistant/components/notify/twitter.py +++ b/homeassistant/components/notify/twitter.py @@ -116,6 +116,9 @@ class TwitterNotificationService(BaseNotificationService): self.log_error_resp(resp) return None + if resp.json().get('processing_info') is None: + return callback(media_id) + self.check_status_until_done(media_id, callback) def media_info(self, media_path):