locked
Creating ContentKeyPolicies Error: caused by ResponseError('too many 500 error responses') RRS feed

  • Question

  • Hello,
    As I was trying to create a ContentKeyPolicy with the Python SDK, once I built all the Options, the error I get with create_or_update module is:

    Traceback (most recent call last):
      File "./ams.py", line 122, in <module>
        GetorCreateContentKeyPolicy(connection,RESOUCE_GROUP_NAME, ACCOUNT_NAME,"policy2")
      File "./ams.py", line 97, in GetorCreateContentKeyPolicy
        policy = client.content_key_policies.create_or_update(resource,account,contentKeyPolicyName,options)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/azure/mgmt/media/operations/_content_key_policies_operations.py", line 256, in create_or_update
        response = self._client.send(request, stream=False, **operation_config)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/service_client.py", line 336, in send
        pipeline_response = self.config.pipeline.run(request, **kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/pipeline/__init__.py", line 197, in run
        return first_node.send(pipeline_request, **kwargs)  # type: ignore
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/pipeline/__init__.py", line 150, in send
        response = self.next.send(request, **kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/pipeline/requests.py", line 72, in send
        return self.next.send(request, **kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/pipeline/requests.py", line 137, in send
        return self.next.send(request, **kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/pipeline/__init__.py", line 150, in send
        response = self.next.send(request, **kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/pipeline/requests.py", line 193, in send
        self.driver.send(request.http_request, **kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/universal_http/requests.py", line 333, in send
        return super(RequestsHTTPSender, self).send(request, **requests_kwargs)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/universal_http/requests.py", line 145, in send
        raise_with_traceback(ClientRequestError, msg, err)
      File "/home/sftpuser/.local/lib/python2.7/site-packages/msrest/exceptions.py", line 54, in raise_with_traceback
        raise error
    msrest.exceptions.ClientRequestError: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/*****************************************/resourceGroups/VOD_System/providers/Microsoft.Media/mediaServices/videoprocessor/contentKeyPolicies/policy2?api-version=2018-07-01 (Caused by ResponseError('too many 500 error responses',))

    The code I used is:

    policy = client.content_key_policies.get(resource,account,contentKeyPolicyName)
    if not policy:
      primaryKey = ContentKeyPolicySymmetricTokenKey(key_value = TokenSigningKey)
      alternateKeys = []
      requiredClaims = [ContentKeyPolicyTokenClaim]
      option2 =  ContentKeyPolicyTokenRestriction(issuer=Issuer,audience=Audience,primary_verification_key=primaryKey,restriction_token_type="Jwt",required_claims=requiredClaims)
      options = [ContentKeyPolicyOption(configuration=ContentKeyPolicyClearKeyConfiguration(), restriction=option2)]
      policy = client.content_key_policies.create_or_update(resource,account,contentKeyPolicyName,options)
    What is happenning? As I am using the Python SDK correctly.

    Thank you,

    BR.


    • Edited by anogueirac Thursday, April 30, 2020 6:40 AM
    Thursday, April 30, 2020 6:19 AM

All replies

  • Hi anogueriac,

    Apologies that you have encountered this issue. It will require closer attention so please email us at AzCommunity[at]microsoft[dot]com ATTN Ryan so that we can take a closer look and get your issue resolved. Include your Azure Media Services account name and subscription id as well as the Python SDK version you are currently using.


    Thanks in advance, Ryan

    Thursday, April 30, 2020 11:19 PM
  • Mail sent! Looking forward your answer.

    Thanks,

    BR.

    Saturday, May 2, 2020 12:20 PM