@@ -1358,7 +1358,7 @@ def test_rsa_client():
13581358
13591359
13601360def test_live_channel ():
1361- print ("create live channel..." )
1361+ print ("create live channel..." )
13621362 livechannel_config = {
13631363 'Description' : 'cos python sdk test' ,
13641364 'Switch' : 'Enabled' ,
@@ -1372,36 +1372,35 @@ def test_live_channel():
13721372
13731373 try :
13741374 response = client .put_live_channel (
1375- Bucket = test_bucket ,
1376- ChannelName = channel_name ,
1377- LiveChannelConfiguration = livechannel_config )
1378- assert (response )
1379- print (response )
1375+ Bucket = test_bucket ,
1376+ ChannelName = channel_name ,
1377+ LiveChannelConfiguration = livechannel_config )
1378+ assert (response )
13801379 except Exception as e :
13811380 if e .get_error_code () != 'ChannelStillLive' :
13821381 return
13831382
1384- print ("get live channel info..." )
1383+ print ("get live channel info..." )
13851384 response = client .get_live_channel_info (
1386- Bucket = test_bucket ,
1387- ChannelName = channel_name )
1385+ Bucket = test_bucket ,
1386+ ChannelName = channel_name )
13881387 print (response )
1389- assert (response ['Switch' ] == 'Enabled' )
1390- assert (response ['Description' ] == 'cos python sdk test' )
1391- assert (response ['Target' ]['Type' ] == 'HLS' )
1392- assert (response ['Target' ]['FragDuration' ] == '3' )
1393- assert (response ['Target' ]['FragCount' ] == '5' )
1394- assert (response ['Target' ]['PlaylistName' ] == 'playlist.m3u8' )
1395-
1396- print ("put live channel switch..." )
1388+ assert (response ['Switch' ] == 'Enabled' )
1389+ assert (response ['Description' ] == 'cos python sdk test' )
1390+ assert (response ['Target' ]['Type' ] == 'HLS' )
1391+ assert (response ['Target' ]['FragDuration' ] == '3' )
1392+ assert (response ['Target' ]['FragCount' ] == '5' )
1393+ assert (response ['Target' ]['PlaylistName' ] == 'playlist.m3u8' )
1394+
1395+ print ("put live channel switch..." )
13971396 client .put_live_channel_switch (
1398- Bucket = test_bucket ,
1399- ChannelName = channel_name ,
1400- Switch = 'disabled' )
1397+ Bucket = test_bucket ,
1398+ ChannelName = channel_name ,
1399+ Switch = 'disabled' )
14011400 response = client .get_live_channel_info (
14021401 Bucket = test_bucket ,
14031402 ChannelName = channel_name )
1404- assert (response ['Switch' ] == 'Disabled' )
1403+ assert (response ['Switch' ] == 'Disabled' )
14051404 client .put_live_channel_switch (
14061405 Bucket = test_bucket ,
14071406 ChannelName = channel_name ,
@@ -1411,32 +1410,32 @@ def test_live_channel():
14111410 ChannelName = channel_name )
14121411 assert (response ['Switch' ] == 'Enabled' )
14131412
1414- print ("get live channel history..." )
1413+ print ("get live channel history..." )
14151414 response = client .get_live_channel_history (
1416- Bucket = test_bucket ,
1417- ChannelName = channel_name )
1415+ Bucket = test_bucket ,
1416+ ChannelName = channel_name )
14181417 print (response )
14191418
1420- print ("get live channel status..." )
1419+ print ("get live channel status..." )
14211420 response = client .get_live_channel_status (
1422- Bucket = test_bucket ,
1423- ChannelName = channel_name )
1421+ Bucket = test_bucket ,
1422+ ChannelName = channel_name )
14241423 print (response )
14251424 assert (response ['Status' ] == 'Idle' or response ['Status' ] == 'Live' )
14261425
1427- print ("list channel..." )
1426+ print ("list channel..." )
14281427 create_chan_num = 20
14291428 for i in range (1 , create_chan_num ):
14301429 ch_name = 'test-list-channel-' + str (i )
14311430 client .put_live_channel (
14321431 Bucket = test_bucket ,
14331432 ChannelName = ch_name ,
14341433 LiveChannelConfiguration = livechannel_config )
1435- response = client .list_live_channel (Bucket = test_bucket , MaxKeys = 10 )
1434+ response = client .list_live_channel (Bucket = test_bucket , MaxKeys = 10 )
14361435 print (response )
14371436 assert (response ['MaxKeys' ] == '10' )
14381437 assert (response ['IsTruncated' ] == 'true' )
1439- response = client .list_live_channel (Bucket = test_bucket , MaxKeys = 5 , Marker = response ['NextMarker' ])
1438+ response = client .list_live_channel (Bucket = test_bucket , MaxKeys = 5 , Marker = response ['NextMarker' ])
14401439 print (response )
14411440 assert (response ['MaxKeys' ] == '5' )
14421441 assert (response ['IsTruncated' ] == 'true' )
@@ -1445,40 +1444,40 @@ def test_live_channel():
14451444 ch_name = 'test-list-channel-' + str (i )
14461445 client .delete_live_channel (Bucket = test_bucket , ChannelName = ch_name )
14471446
1448- print ("post vod playlist" )
1447+ print ("post vod playlist" )
14491448 try :
14501449 client .post_vod_playlist (
1451- Bucket = test_bucket ,
1452- ChannelName = channel_name ,
1453- PlaylistName = 'test' ,
1454- StartTime = int (time .time ()) - 10000 ,
1455- EndTime = int (time .time ()))
1450+ Bucket = test_bucket ,
1451+ ChannelName = channel_name ,
1452+ PlaylistName = 'test' ,
1453+ StartTime = int (time .time ()) - 10000 ,
1454+ EndTime = int (time .time ()))
14561455 except Exception as e :
1457- print e
1456+ print_error_msg ( e )
14581457 try :
14591458 client .post_vod_playlist (
1460- Bucket = test_bucket ,
1461- ChannelName = channel_name ,
1462- PlaylistName = 'test.m3u8' ,
1463- StartTime = 10 ,
1464- EndTime = 9 )
1459+ Bucket = test_bucket ,
1460+ ChannelName = channel_name ,
1461+ PlaylistName = 'test.m3u8' ,
1462+ StartTime = 10 ,
1463+ EndTime = 9 )
14651464 except Exception as e :
1466- print e
1465+ print_error_msg ( e )
14671466
14681467 client .post_vod_playlist (
1469- Bucket = test_bucket ,
1470- ChannelName = channel_name ,
1471- PlaylistName = 'test.m3u8' ,
1472- StartTime = int (time .time ()) - 10000 ,
1473- EndTime = int (time .time ()))
1468+ Bucket = test_bucket ,
1469+ ChannelName = channel_name ,
1470+ PlaylistName = 'test.m3u8' ,
1471+ StartTime = int (time .time ()) - 10000 ,
1472+ EndTime = int (time .time ()))
14741473 response = client .head_object (
1475- Bucket = test_bucket ,
1476- Key = channel_name + '/test.m3u8' )
1477- assert (response )
1474+ Bucket = test_bucket ,
1475+ Key = channel_name + '/test.m3u8' )
1476+ assert (response )
14781477
1479- print ("delete live channel..." )
1478+ print ("delete live channel..." )
14801479 response = client .delete_live_channel (Bucket = test_bucket , ChannelName = channel_name )
1481- assert (response )
1480+ assert (response )
14821481
14831482if __name__ == "__main__" :
14841483 setUp ()
0 commit comments