If either the API key is wrong or the transcript id is not available, there happens a bad error handling in get_by_id.
During handling of the above exception, another exception occurred.
The reason is that further down the line in wait_for_completion() we try to unpack a dictionary which then throws another exception.
Should be improved.
import assemblyai as aai
aai.settings.api_key = "some_key"
transcript = aai.Transcript.get_by_id("1234")
Traceback (most recent call last):
File "/Users/patrick/projects/assemblyai-python-sdk/assemblyai/transcriber.py", line 79, in wait_for_completion
self.transcript = api.get_transcript(
^^^^^^^^^^^^^^^^^^^
File "/Users/patrick/projects/assemblyai-python-sdk/assemblyai/api.py", line 61, in get_transcript
raise types.TranscriptError(
assemblyai.types.TranscriptError: failed to retrieve transcript 1234: Authentication error, API token missing/invalid
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/patrick/projects/assemblyai-python-sdk/ent-test.py", line 5, in <module>
t = aai.Transcript.get_by_id("1234")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/patrick/projects/assemblyai-python-sdk/assemblyai/transcriber.py", line 255, in get_by_id
return cls(transcript_id=transcript_id).wait_for_completion()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/patrick/projects/assemblyai-python-sdk/assemblyai/transcriber.py", line 218, in wait_for_completion
self._impl.wait_for_completion()
File "/Users/patrick/projects/assemblyai-python-sdk/assemblyai/transcriber.py", line 85, in wait_for_completion
**self.transcript.dict(
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'dict'
If either the API key is wrong or the transcript id is not available, there happens a bad error handling in
get_by_id
.During handling of the above exception, another exception occurred.
The reason is that further down the line in
wait_for_completion()
we try to unpack a dictionary which then throws another exception.Should be improved.