twilio-python icon indicating copy to clipboard operation
twilio-python copied to clipboard

Composition Hooks API attribute error

Open divergentsigns opened this issue 3 years ago • 1 comments

Issue Summary

When creating a composition hook it returns attribute error 'Video' object has no attribute 'Composition_Hook'.

Code Snippet

from twilio.rest import Client
client = Client(api_key_sid, api_key_secret)

compositionHook = client.video.compositionHooks.create(
			friendlyName = 'MyFirstCompositionHook',
			audio_sources = '*',
		video_layout = {
						'grid' : {
							'video_sources': ['*']}},
			status_callback = 'http://my.server.org/callbacks',
			format='mp4')
		print('Created Composition Hook with SID=%s' % (compositionHook.sid))

Exception/Log

AttributeError at /hook/
'Video' object has no attribute 'compositionHooks'

Request Method: POST
Request URL: http://127.0.0.1:8000/hook/
Django Version: 2.2.9
Python Executable: /Users/azeem/Documents/projects/directpads/env/bin/python
Python Version: 3.9.0
Python Path: ['/Users/azeem/Documents/projects/directpads/directpad-master', '/Library/Frameworks/Python.framework/Versions/3.9/lib/python39.zip', '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9', '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload', '/Users/azeem/Documents/projects/directpads/env/lib/python3.9/site-packages']
Server time: Sun, 18 Jul 2021 10:30:02 -0500
### Technical details:
* twilio-python version:  6.62.0
* python version: 3.9.0

divergentsigns avatar Jul 18 '21 15:07 divergentsigns

Hello @divergentsigns,

I was able to recreate your issue.

This was the code that ultimately worked for me:

client = Client(api_key_sid, api_key_secret)

compositionHook = client.video.composition_hooks.create(
    friendly_name = 'MixingAllRoomAudiosHook',
    audio_sources = '*',
    status_callback = 'http://my.server.org/callbacks',
    format='mp4')

print('Created Composition Hook with SID=%s' % (compositionHook.sid))

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

With best regards,

Elmer

thinkingserious avatar Jul 20 '21 00:07 thinkingserious

Our code samples have been updated to reflect the correct casing for composition hooks and friendly name in the PR linked above.

JenniferMah avatar Jan 20 '23 21:01 JenniferMah