aws_debug.py 1.7 KB

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