bitmovin / bitmovin-python

DEPRECATED: Python client for the Bitmovin API, see https://github.com/bitmovin/bitmovin-api-sdk-python
The Unlicense
38 stars 20 forks source link

An error occured after adding AES encryption if key_file_uri is blank #150

Open subaru-shoji opened 5 years ago

subaru-shoji commented 5 years ago

I set None to key_file_uri to create encryption.key. Then submit like below.

aes128 = AESDRM(
    key=key,
    iv=iv,
    outputs=[output],
    method='AES_128',
    key_file_uri=None,
    name=name
)
bitmovin.encodings.Muxing.TS.DRM.AES.create(object_=aes128,
                                            encoding_id=encoding_id,
                                            muxing_id=muxing_id).resource

After that, an error occued on receiving response.

  File "/Users/shoji/Documents/ghq/github.logica.io/streaks/bitmovin-handler/.venv/lib/python3.7/site-packages/bitmovin/services/rest_service.py", line 31, in create
    response=response, class_=self.class_)
  File "/Users/shoji/Documents/ghq/github.logica.io/streaks/bitmovin-handler/.venv/lib/python3.7/site-packages/bitmovin/services/parsing_utils.py", line 38, in parse_bitmovin_resource_from_response
    resource = class_.parse_from_json_object(json_object=result)
  File "/Users/shoji/Documents/ghq/github.logica.io/streaks/bitmovin-handler/.venv/lib/python3.7/site-packages/bitmovin/resources/models/encodings/drms/aes_drm.py", line 25, in parse_from_json_object
    key_file_uri = json_object['keyFileUri']

I think json response doesn't have keyFileUrl key if I set None It should be .get like below.

class AESDRM(DRM):
    ...

    @classmethod
    def parse_from_json_object(cls, json_object):
        drm = super().parse_from_json_object(json_object=json_object)
        ...
        key_file_uri = json_object.get('keyFileUri')
        iv = json_object.get('iv')

        aes_drm = AESDRM(method=method, key=key, key_file_uri=key_file_uri, iv=iv, outputs=outputs, id_=id_,
                         custom_data=custom_data, name=name, description=description)

        return aes_drm
matt-lee-bitmovin commented 5 years ago

Hello, we have just released 1.52.0 with an improvement to make the key_file_uri optional, so you can not specify it, and it should now succeed.

Please update your Python client, and let us know the result