10000 Merge branch 'prateem-document-exceptions' · githubib/twilio-python@1e3d778 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e3d778

Browse files
author
Sam Harrison
committed
Merge branch 'prateem-document-exceptions'
2 parents 6779781 + 76162f4 commit 1e3d778

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,23 @@ message = client.messages.create(to="+12316851234", from_="+15555555555",
114114
body="Hello there!")
115115
```
116116

117+
### Handling Exceptions
118+
119+
```python
120+
from twilio.rest import Client
121+
from twilio.base.exceptions import TwilioRestException
122+
123+
account = "ACXXXXXXXXXXXXXXXXX"
124+
token = "YYYYYYYYYYYYYYYYYY"
125+
client = Client(account, token)
126+
127+
try:
128+
message = client.messages.create(to="+12316851234", from_="+15555555555",
129+
body="Hello there!")
130+
except TwilioRestException as e:
131+
print(e)
132+
```
133+
117134
### Generating TwiML
118135

119136
To control phone calls, your application needs to output [TwiML][twiml].

0 commit comments

Comments
 (0)
0