8000 Allow both digits and url; remove unused import · Web5design/twilio-python@9b10f30 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b10f30

Browse files
committed
Allow both digits and url; remove unused import
1 parent ca7814a commit 9b10f30

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

tests/test_twiml.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,6 @@ def testPlayDigits(self):
157157
def testUrlOrDigitsRequired(self):
158158
self.assertRaises(TwimlException, twiml.Play)
159159

160-
def testEitherUrlOrDigits(self):
161-
self.assertRaises(TwimlException, twiml.Play, url='http://example.com', digits='1')
162-
163160

164161
class TestRecord(TwilioTest):
165162

twilio/twiml.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Make sure to check out the TwiML overview and tutorial
33
"""
44
import xml.etree.ElementTree as ET
5-
from six import iteritems
65

76

87
class TwimlException(Exception):
@@ -240,13 +239,16 @@ def __init__(self, text, **kwargs):
240239
class Play(Verb):
241240
"""Play DTMF digits or audio from a URL.
242241
243-
:param str url: point to af audio file. The MIME type on the file must be
244-
set correctly. Either `url` or `digits` must be specified.
242+
:param str url: point to an audio file. The MIME type on the file must be
243+
set correctly. At least one of `url` and `digits` must be
244+
specified. If both are given, the digits will play prior
245+
to the audio from the URL.
245246
246247
:param str digits: a string of digits to play. To pause before playing
247248
digits, use leading 'w' characters. Each 'w' will cause
248249
Twilio to wait 0.5 seconds instead of playing a digit.
249-
Either `url` or `digits` must be specified.
250+
At least one of `url` and `digits` must be specified.
251+
If both are given, the digits will play first.
250252
251253
:param int loop: specifies how many times you'd like the text repeated.
252254
Specifying '0' will cause the the :class:`Play` verb to loop
@@ -257,8 +259,6 @@ def __init__(self, url=None, digits=None, **kwargs):
257259
raise TwimlException(
258260
"Please specify either a url or digits to play.",
259261
)
260-
if url is not None and digits is not None:
261-
raise TwimlException("Please specify only one of: (url, digits).")
262262

263263
if digits is not None:
264264
kwargs['digits'] = digits

0 commit comments

Comments
 (0)
0