2
2
3
3
4
4
class MessagingResponse (TwiML ):
5
-
5
+ """
6
+ Messaging TwiML Response
7
+ """
6
8
def __init__ (self ):
9
+ """
10
+ Create a new <Response>
11
+ """
7
12
super (MessagingResponse , self ).__init__ ()
8
13
self .name = 'Response'
9
14
@@ -15,6 +20,18 @@ def message(self,
15
20
action = None ,
16
21
status_callback = None ,
17
22
** 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
+ """
18
35
return self .append (Message (
19
36
body = body ,
20
37
to = to ,
@@ -26,6 +43,14 @@ def message(self,
26
43
))
27
44
28
45
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
+ """
29
54
return self .append (Redirect (
30
55
method = method ,
31
56
url = url ,
@@ -34,31 +59,70 @@ def redirect(self, method=None, url=None, **kwargs):
34
59
35
60
36
61
class Message (TwiML ):
37
-
62
+ """
63
+ <Message> element
64
+ """
38
65
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
+ """
39
72
super (Message , self ).__init__ (** kwargs )
40
73
if body :
41
74
self .body = body
42
75
43
76
def body (self , body ):
77
+ """
78
+ Add a <Body> element
79
+
80
+ :param body: body of message
81
+ :return: <Body> element
82
+ """
44
83
return self .append (Body (body ))
45
84
46
85
def media (self , url ):
86
+ """
87
+ Add a <Media> element
88
+
89
+ :param url: media URL
90
+ :return: <Media> element
91
+ """
47
92
return self .append (Media (url ))
48
93
49
94
50
95
class Body (TwiML ):
96
+ """
97
+ <Body> element
98
+ """
51
99
def __init__ (self , body ):
100
+ """
101
+ Create a new <Body> element
102
+
103
+ :param body: message body
104
+ """
52
105
super (Body , self ).__init__ ()
53
106
self .body = body
54
107
55
108
56
109
class Media (TwiML ):
110
+ """
111
+ <Media> element
112
+ """
57
113
def __init__ (self , url ):
114
+ """
115
+ Create a new <Media> element
116
+
117
+ :param url: media URL location
118
+ """
58
119
super (Media , self ).__init__ ()
59
120
self .body = url
60
121
61
122
62
123
class Redirect (TwiML ):
124
+ """
125
+ <Redirect> element
126
+ """
63
127
pass
64
128
0 commit comments