|
23 | 23 | 'Called' : '415-555-1212',
|
24 | 24 | 'Url' : 'http://demo.twilio.com/welcome',
|
25 | 25 | }
|
26 |
| -print account.request('/%s/Accounts/%s/Calls' % \ |
27 |
| - (API_VERSION, ACCOUNT_SID), 'POST', d) |
| 26 | +try: |
| 27 | + print account.request('/%s/Accounts/%s/Calls' % \ |
| 28 | + (API_VERSION, ACCOUNT_SID), 'POST', d) |
| 29 | +except Exception, e: |
| 30 | + print e |
| 31 | + print e.read() |
28 | 32 |
|
29 | 33 | # ===========================================================================
|
30 | 34 | # 2. Get a list of recent completed calls (i.e. Status = 2)
|
31 | 35 | # uses a HTTP GET
|
32 | 36 | d = { 'Status':2, }
|
33 |
| -print account.request('/%s/Accounts/%s/Calls' % \ |
34 |
| - (API_VERSION, ACCOUNT_SID), 'GET', d) |
| 37 | +try: |
| 38 | + print account.request('/%s/Accounts/%s/Calls' % \ |
| 39 | + (API_VERSION, ACCOUNT_SID), 'GET', d) |
| 40 | +except Exception, e: |
| 41 | + print e |
| 42 | + print e.read() |
35 | 43 |
|
36 | 44 | # ===========================================================================
|
37 | 45 | # 3. Get a list of recent notification log entries
|
38 | 46 | # uses a HTTP GET
|
39 |
| -print account.request('/%s/Accounts/%s/Notifications' % \ |
40 |
| - (API_VERSION, ACCOUNT_SID), 'GET') |
| 47 | +try: |
| 48 | + print account.request('/%s/Accounts/%s/Notifications' % \ |
| 49 | + (API_VERSION, ACCOUNT_SID), 'GET') |
| 50 | +except Exception, e: |
| 51 | + print e |
| 52 | + print e.read() |
41 | 53 |
|
42 | 54 | # ===========================================================================
|
43 | 55 | # 4. Get a list of audio recordings for a certain call
|
44 | 56 | # uses a HTTP GET
|
45 | 57 | d = { 'CallSid':'CA0c7001f3f3f5063b7f7d96def0f1ed00', }
|
46 |
| -print account.request('/%s/Accounts/%s/Recordings' % \ |
47 |
| - (API_VERSION, ACCOUNT_SID), 'GET', d) |
48 |
| - |
| 58 | +try: |
| 59 | + print account.request('/%s/Accounts/%s/Recordings' % \ |
| 60 | + (API_VERSION, ACCOUNT_SID), 'GET', d) |
| 61 | +except Exception, e: |
| 62 | + print e |
| 63 | + print e.read() |
| 64 | + |
49 | 65 | # ===========================================================================
|
50 | 66 | # 5. Delete a specific recording
|
51 | 67 | # uses a HTTP DELETE, no response is returned when using DELETE
|
52 |
| -account.request( \ |
53 |
| - '/%s/Accounts/%s/Recordings/RE4e75a0b62a5c52e5cb96dc25fb4101d9' % \ |
54 |
| - (API_VERSION, ACCOUNT_SID), 'DELETE') |
| 68 | +try: |
| 69 | + account.request( \ |
| 70 | + '/%s/Accounts/%s/Recordings/RE4e75a0b62a5c52e5cb96dc25fb4101d9' % \ |
| 71 | + (API_VERSION, ACCOUNT_SID), 'DELETE') |
| 72 | +except Exception, e: |
| 73 | + print e |
| 74 | + print e.read() |
0 commit comments