Search code examples
pythonamazon-web-servicesboto3aws-media-live

Changing input url in MediaLive


I'm trying to update an Input MediaLive URL using boto3 in python.

The input is an URL_PULL type (HLS) and is attached to a channel, and I think it's the source of my issue.

account = { all credentials and stuff }
url = 'https://mynew/supercool/hls/playlist.m3u8'
client = boto3.client("medialive",
                      aws_access_key_id=account['access_key'],
                      aws_secret_access_key=account['key_secret'],
                      region_name=account['region_name'])

input_id = 1234567
client.update_input(InputId=input_id, Sources=[{'Url': url}])

The code is working fine, but I get this error, and I don't know how to handle it :

An error occurred (BadRequestException) when calling the UpdateInput operation: You cannot change the input class of an input while it's attached to a channel. Please detach the input from the channel in order to switch its class.

Question : Which workflow should I use to update an input that is already attached to a channel ?


Solution

  • AWS API expects 2 urls when updating an input, main and backup.

    client.update_input(InputId=input_id, Sources=[{'Url': url},{'Url': url}])