kbt.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. aws_access_key_id = 'AKIA2E67UIMD45Y3HL53'
  2. aws_secret_access_key = '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'
  3. REGION_NAME = 'us-east-1' # e.g
  4. from datetime import datetime
  5. startTime =datetime(2019, 11, 15,2,0)
  6. endTime =datetime(2019, 11, 15,4,0)
  7. print(startTime)
  8. print(endTime)
  9. def lmm():
  10. import boto3
  11. print('1234')
  12. STREAM_NAME = "oxoxo"
  13. kvs = boto3.client("kinesisvideo")
  14. # Grab the endpoint from GetDataEndpoint
  15. endpoint = kvs.get_data_endpoint(
  16. APIName="GET_HLS_STREAMING_SESSION_URL",
  17. StreamName=STREAM_NAME
  18. )['DataEndpoint']
  19. print(endpoint)
  20. print('----------')
  21. # Grab the HLS Stream URL from the endpoint
  22. kvam = boto3.client("kinesis-video-archived-media", endpoint_url=endpoint)
  23. url = kvam.get_hls_streaming_session_url(
  24. StreamName=STREAM_NAME,
  25. PlaybackMode="LIVE_REPLAY",
  26. HLSFragmentSelector={
  27. 'FragmentSelectorType': 'PRODUCER_TIMESTAMP',
  28. 'TimestampRange': {
  29. 'StartTimestamp': startTime,
  30. 'EndTimestamp': endTime
  31. }
  32. },
  33. )['HLSStreamingSessionURL']
  34. print(url)
  35. exit()
  36. lmm()
  37. exit()
  38. import boto3
  39. boto3_session = boto3.Session(aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_access_key_id)
  40. kv_client = boto3_session.client('kinesisvideo',region_name='us-east-1')
  41. STREAM_NAME = "oxoxo"
  42. print(STREAM_NAME)
  43. endpoint = kv_client.get_data_endpoint(
  44. APIName="GET_HLS_STREAMING_SESSION_URL",
  45. # APIName="ListStreams",
  46. StreamName=STREAM_NAME
  47. )['DataEndpoint']
  48. print(endpoint)
  49. exit()
  50. res = kv_client.describe_stream(StreamName='test_stream')
  51. print(res)