Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Creation of Transcribe Recording fails #3

Closed
0x19 opened this Issue · 1 comment

2 participants

@0x19
Owner

There are multiple issues within following code:

from telapi import rest

account_sid = '{AccountSid}'
auth_token  = '{AuthToken}'
client      = rest.Client(account_sid, auth_token)
account     = client.accounts[client.account_sid]

recording_sid = False

for recording in account.recordings[:1]: 
   recording_sid = recording.sid

transcribe  = account.recordings[recording_sid].transcriptions.create( 
    transcribe_callback = 'http://liveoutput.com/transcribecallback',
    quality = 'gold'
)
print "Transcribe Recording Sid: %s" % transcribe.sid

1.) Quality POST parameter is missing from allowed attributes

File "test.py", line 15, in <module>
    quality = 'gold'
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 208, in create
    resource_instance = self.new(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 203, in new
    resource_instance = _name_to_instance_class(self._name)(parent=self, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 244, in __init__
    setattr(self, key, value)
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 306, in __setattr__
    raise AttributeError("'%s' not a valid attribute of %s (allowed attributes: %s)" % (name, self, self._allowed_attributes))
AttributeError: 'quality' not a valid attribute of <telapi.rest.Transcription object at 0x2bdd3d0> (allowed attributes: [u'status', u'recording_sid', u'date_updated', u'price', u'transcribe_callback', u'audio_url', u'duration', u'callback_method', u'transcription_text', u'uri', u'account_sid', u'sid', u'date_created', u'type', u'api_version'])

2.)

  File "test.py", line 14, in <module>
    transcribe_callback = 'http://liveoutput.com/transcribecallback'
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 209, in create
    resource_instance.save()
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 319, in save
    resource_data = self._client._post(self._url + ".json", data)
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 395, in _post
    return self._send_request(resource_uri, "POST", params)
  File "/usr/local/lib/python2.7/dist-packages/telapi-0.0.3-py2.7.egg/telapi/rest/__init__.py", line 389, in _send_request
    return json.loads(response.text)
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 18 column 5 (char 518)
@mattwilliamson

Tested to be working with code provided above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.