File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ #Day 27 & 28
2+
3+ import requests
4+ from twilio .rest import TwilioRestClient
5+
6+ account_sid = 'ACe96e664d910ae38b8cd106083f24cdfd' #account_sid
7+ auth_token = '746bf9cfb19d88592d5a8b46b1f806f2' #auth_token
8+ client = TwilioRestClient (account_sid , auth_token )
9+
10+ number_to_text = '+19494413233' #+1-(949)-441-3233
11+ twilio_number = '+17472332016' #+1-(747)-233-2016
12+ message_body = 'Another new one!!'
13+ media_url = 'http://img2.10bestmedia.com/Images/Photos/96123/captiva-beach-captiva_54_990x660_201404211817.jpg'
14+
15+ """
16+ Create / Send --- POST METHOD
17+ """
18+
19+ message = client .messages .create (
20+ to = number_to_text ,
21+ from_ = twilio_number ,
22+ body = message_body ,
23+ media_url = media_url ,
24+ )
25+
26+ print (message .sid )
27+ print (message .media_list .list ())
28+
29+
30+ message_data = client .messages .get (sid = 'MM84e7ab9fd6af47a6a7e4012703ba317c' )
31+
32+ print (message_data )
33+ print (dir (message_data ))
34+
35+ image_list = [i .uri for i in message_data .media_list .list ()]
36+ print (image_list )
37+
38+
39+ """
40+ the_new_list = []
41+ for x in some_list:
42+ the_new_list.append(x.uri)
43+
44+
45+ OPTIONAL
46+ status_callback = "http://www.yourwebsite.com/some/way/to/handle/"
47+
48+ message = client.messages.create(
49+ to=number_to_text,
50+ from_=twilio_number,
51+ body=message_body,
52+ media_url=media_url,
53+ status_callback=status_callback,
54+ )
55+ """
56+
57+
58+
59+
60+
61+ def xml_pretty (xml_string ):
62+ import xml .dom .minidom
63+ xml = xml .dom .minidom .parseString (xml_string )
64+ pretty_xml_ = xml .toprettyxml ()
65+ print (pretty_xml_ )
66+
67+
68+
69+
70+
You can’t perform that action at this time.
0 commit comments