From 45878c6df03d2199a3b56842ee9f66b843b3bd0d Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Thu, 18 Oct 2018 00:17:55 -0700 Subject: [PATCH] Upgrade twilio package to version 6.19.1 (#17395) (#17424) - Bump twilio requirement to latest 6.19.1 version - The generic response type is gone in the latest versions of the twilio package. It appears we were generating an empty response just to get the empty xml body. TwilML is the new base class all responses inherit from. So I've switched the code over to using and empty TwilML object instead. - The exception type was moved to a different location. --- homeassistant/components/notify/twilio_call.py | 2 +- homeassistant/components/twilio.py | 6 +++--- requirements_all.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/notify/twilio_call.py b/homeassistant/components/notify/twilio_call.py index b517808d2ce..538a4fd9512 100644 --- a/homeassistant/components/notify/twilio_call.py +++ b/homeassistant/components/notify/twilio_call.py @@ -42,7 +42,7 @@ class TwilioCallNotificationService(BaseNotificationService): def send_message(self, message="", **kwargs): """Call to specified target users.""" - from twilio import TwilioRestException + from twilio.base.exceptions import TwilioRestException targets = kwargs.get(ATTR_TARGET) diff --git a/homeassistant/components/twilio.py b/homeassistant/components/twilio.py index 9f32a44ce7e..9f9767e4675 100644 --- a/homeassistant/components/twilio.py +++ b/homeassistant/components/twilio.py @@ -10,7 +10,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.core import callback from homeassistant.components.http import HomeAssistantView -REQUIREMENTS = ['twilio==5.7.0'] +REQUIREMENTS = ['twilio==6.19.1'] DOMAIN = 'twilio' @@ -51,8 +51,8 @@ class TwilioReceiveDataView(HomeAssistantView): @callback def post(self, request): # pylint: disable=no-self-use """Handle Twilio data post.""" - from twilio.twiml import Response + from twilio.twiml import TwiML hass = request.app['hass'] data = yield from request.post() hass.bus.async_fire(RECEIVED_DATA, dict(data)) - return Response().toxml() + return TwiML().to_xml() diff --git a/requirements_all.txt b/requirements_all.txt index f68bf195f7e..4e9248dc931 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1485,7 +1485,7 @@ transmissionrpc==0.11 tuyapy==0.1.3 # homeassistant.components.twilio -twilio==5.7.0 +twilio==6.19.1 # homeassistant.components.sensor.uber uber_rides==0.6.0