Skip to content

Instantly share code, notes, and snippets.

@lippytak
Created October 14, 2014 20:05
Show Gist options
  • Save lippytak/11067a73e757d64e3ab6 to your computer and use it in GitHub Desktop.
Save lippytak/11067a73e757d64e3ab6 to your computer and use it in GitHub Desktop.
from twilio.rest import TwilioRestClient
import re
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'hi'
auth_token = 'there'
client = TwilioRestClient(account_sid, auth_token)
bads = []
# A list of transcription objects with the properties described above
# transcriptions = client.transcriptions.list(page_size = 1000)
regex = re.compile(r'\$.*\s')
for t in client.transcriptions.iter():
text = t.transcription_text
amount = ''
try:
amount_str = re.search('\S*(\$\d+\.\d\d)', text).group(1)
amount = int(amount_str.split('.')[0][1:])
except:
pass
if amount and amount > 1000:
recording = client.recordings.get(t.recording_sid)
print '%s | %s' % (amount_str, recording.uri + '.mp3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment