8000 Add docs · bradddd/twilio-python@b84ed80 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b84ed80

Browse files
committed
Add docs
1 parent 159a5ad commit b84ed80

File tree

2 files changed

+409
-3
lines changed

2 files changed

+409
-3
lines changed

twilio/twiml/messaging_response.py

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33

44
class MessagingResponse(TwiML):
5-
5+
"""
6+
Messaging TwiML Response
7+
"""
68
def __init__(self):
9+
"""
10+
Create a new <Response>
11+
"""
712
super(MessagingResponse, self).__init__()
813
self.name = 'Response'
914

@@ -15,6 +20,18 @@ def message(self,
1520
action=None,
1621
status_callback=None,
1722
**kwargs):
23+
"""
24+
Add a <Message> element
25+
26+
:param body: body of the message
27+
:param to: number to send to
28+
:param from_: number to send from
29+
:param method: action HTTP method
30+
:param action: action URL
31+
:param status_callback: callback URL
32+
:param kwargs: other attributes
33+
:return: <Message> element
34+
"""
1835
return self.append(Message(
1936
body=body,
2037
to=to,
@@ -26,6 +43,14 @@ def message(self,
2643
))
2744

2845
def redirect(self, method=None, url=None, **kwargs):
46+
"""
47+
Add a <Redirect> element
48+
49+
:param method: HTTP method
50+
:param url: URL to redirect to
51+
:param kwargs: other attributes
52+
:return: <Redirect> element
53+
"""
2954
return self.append(Redirect(
3055
method=method,
3156
url=url,
@@ -34,31 +59,70 @@ def redirect(self, method=None, url=None, **kwargs):
3459

3560

3661
class Message(TwiML):
37-
62+
"""
63+
<Message> element
64+
"""
3865
def __init__(self, body=None, **kwargs):
66+
"""
67+
Create a new <Message> element
68+
69+
:param body: body of message
70+
:param kwargs: other attributes
71+
"""
3972
super(Message, self).__init__(**kwargs)
4073
if body:
4174
self.body = body
4275

4376
def body(self, body):
77+
"""
78+
Add a <Body> element
79+
80+
:param body: body of message
81+
:return: <Body> element
82+
"""
4483
return self.append(Body(body))
4584

4685
def media(self, url):
86+
"""
87+
Add a <Media> element
88+
89+
:param url: media URL
90+
:return: <Media> element
91+
"""
4792
return self.append(Media(url))
4893

4994

5095
class Body(TwiML):
96+
"""
97+
<Body> element
98+
"""
5199
def __init__(self, body):
100+
"""
101+
Create a new <Body> element
102+
103+
:param body: message body
104+
"""
52105
super(Body, self).__init__()
53106
self.body = body
54107

55108

56109
class Media(TwiML):
110+
"""
111+
<Media> element
112+
"""
57113
def __init__(self, url):
114+
"""
115+
Create a new <Media> element
116+
117+
:param url: media URL location
118+
"""
58119
super(Media, self).__init__()
59120
self.body = url
60121

61122

62123
class Redirect(TwiML):
124+
"""
125+
<Redirect> element
126+
"""
63127
pass
64128

0 commit comments

Comments
 (0)
0