{"id":260,"date":"2018-06-29T19:21:52","date_gmt":"2018-06-29T09:21:52","guid":{"rendered":"https:\/\/blog.hegars.com\/?p=260"},"modified":"2018-07-03T14:29:02","modified_gmt":"2018-07-03T04:29:02","slug":"twilio-delete-recordings","status":"publish","type":"post","link":"https:\/\/blog.hegars.com\/?p=260","title":{"rendered":"Twilio &#8211; Delete recordings"},"content":{"rendered":"<p>from this\u00a0https:\/\/www.twilio.com\/blog\/2016\/05\/bulk-delete-your-twilio-recordings-with-python.html but updated for new API<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n\r\nfrom twilio.rest import Client\r\nfrom datetime import datetime\r\nimport os\r\n\r\n# Your Account SID from twilio.com\/console\r\naccount_sid = &quot;SID&quot;\r\n#account_sid = os.environ&#x5B;&quot;TWILIO_ACCOUNT_SID&quot;]\r\n# Your Auth Token from twilio.com\/console\r\nauth_token = &quot;TOKEN&quot;\r\n#auth_token = os.environ&#x5B;&quot;TWILIO_AUTH_TOKEN&quot;]\r\nclient = Client(account_sid, auth_token)\r\n\r\nrecordings = client.recordings\\\r\n.list(\r\ndate_created_before=datetime(2018, 1, 1),\r\ndate_created_after=datetime(2016, 1, 1)\r\n)\r\n\r\nfor record in recordings:\r\n# client.recordings('record.sid').delete()\r\nclient.recordings(record.sid).delete()\r\nprint(&quot;Deletings Recording: &quot;, record.sid)\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-267\" src=\"https:\/\/blog.hegars.com\/wp-content\/uploads\/2018\/06\/twiliodelrec-1024x404.png\" alt=\"\" width=\"1024\" height=\"404\" srcset=\"https:\/\/blog.hegars.com\/wp-content\/uploads\/2018\/06\/twiliodelrec-1024x404.png 1024w, https:\/\/blog.hegars.com\/wp-content\/uploads\/2018\/06\/twiliodelrec-300x118.png 300w, https:\/\/blog.hegars.com\/wp-content\/uploads\/2018\/06\/twiliodelrec-768x303.png 768w, https:\/\/blog.hegars.com\/wp-content\/uploads\/2018\/06\/twiliodelrec-1080x426.png 1080w, https:\/\/blog.hegars.com\/wp-content\/uploads\/2018\/06\/twiliodelrec.png 1397w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>something was wrong and it kept stalling so I needed to loop it &#8211; bash hack.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwhile true ; do time python3 del_rec.py ; done\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>from this\u00a0https:\/\/www.twilio.com\/blog\/2016\/05\/bulk-delete-your-twilio-recordings-with-python.html but updated for new API from twilio.rest import Client from datetime import datetime import os # Your Account SID from twilio.com\/console account_sid = &quot;SID&quot; #account_sid = os.environ&#x5B;&quot;TWILIO_ACCOUNT_SID&quot;] # Your Auth Token from twilio.com\/console auth_token = &quot;TOKEN&quot; #auth_token = os.environ&#x5B;&quot;TWILIO_AUTH_TOKEN&quot;] client = Client(account_sid, auth_token) recordings = client.recordings\\ .list( date_created_before=datetime(2018, 1, 1), date_created_after=datetime(2016, 1, 1) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[13,3,14],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hegars.com\/index.php?rest_route=\/wp\/v2\/posts\/260"}],"collection":[{"href":"https:\/\/blog.hegars.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hegars.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hegars.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hegars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=260"}],"version-history":[{"count":5,"href":"https:\/\/blog.hegars.com\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":269,"href":"https:\/\/blog.hegars.com\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions\/269"}],"wp:attachment":[{"href":"https:\/\/blog.hegars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hegars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hegars.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}