chenjunkai 5 년 전
부모
커밋
193f476a1f
2개의 변경된 파일55개의 추가작업 그리고 124개의 파일을 삭제
  1. 55 55
      Ansjer/test/aws_debug.py
  2. 0 69
      Ansjer/test/kbt.py

+ 55 - 55
Ansjer/test/aws_debug.py

@@ -1,69 +1,69 @@
-#!/usr/bin/env python3  
-# -*- coding: utf-8 -*-  
-"""
-@Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
-@AUTHOR: ASJRD018
-@NAME: AnsjerFormal
-@software: PyCharm
-@DATE: 2019/11/13 14:38
-@Version: python3.6
-@MODIFY DECORD:ansjer dev
-@file: aws_debug.py
-@Contact: chanjunkai@163.com
-"""
-import boto3
+poio = '+08.00'
+print(float(poio))
+tt = float(poio)
+a = 2
+cc = a*tt
+print(cc)
+exit()
 
+aws_access_key_id = 'AKIA2E67UIMD45Y3HL53'
+aws_secret_access_key = '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'
 REGION_NAME = 'us-east-1'  # e.g
-import json
+from datetime import datetime
 
+startTime = datetime(2019, 12, 11, 2, 0)
+endTime = datetime(2019, 12, 11, 8, 0)
+print(startTime)
+print(endTime)
 
-def generate_sts_boto3():
-    sts = boto3.client(
-        'sts',
-        aws_access_key_id='AKIA2E67UIMD45Y3HL53',
-        aws_secret_access_key='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',
-        region_name=REGION_NAME
-    )
 
-    Policy = {"Version": "2012-10-17",
-              "Statement": [{"Effect": "Allow", "Action": "kinesisvideo:*", "Resource": ['*']}]}
-    credentials = sts.get_federation_token(
-        Name='chanjunkai@163.com',  # or any unique text related to user
-        Policy=json.dumps(Policy),
-        DurationSeconds=3600,
-    )
+def lmm():
+    import boto3
+    print('1234')
+    STREAM_NAME = "oxoxo"
+    kvs = boto3.client("kinesisvideo")
+    # Grab the endpoint from GetDataEndpoint
+    endpoint = kvs.get_data_endpoint(
+        APIName="GET_HLS_STREAMING_SESSION_URL",
+        StreamName=STREAM_NAME
+    )['DataEndpoint']
+    print(endpoint)
+    print('----------')
+    # Grab the HLS Stream URL from the endpoint
+    kvam = boto3.client("kinesis-video-archived-media", endpoint_url=endpoint)
+    url = kvam.get_hls_streaming_session_url(
+        StreamName=STREAM_NAME,
+        PlaybackMode="LIVE_REPLAY",
+        HLSFragmentSelector={
+            'FragmentSelectorType': 'PRODUCER_TIMESTAMP',
+            'TimestampRange': {
+                'StartTimestamp': startTime,
+                'EndTimestamp': endTime
+            }
+        },
+    )['HLSStreamingSessionURL']
+    print(url)
+    exit()
 
-    print(credentials)
-    access_key_id = credentials['Credentials']['AccessKeyId']
-    session_token = credentials['Credentials']['SessionToken']
-    secret_access_key = credentials['Credentials']['SecretAccessKey']
-    res = {
-        'access_key_id': access_key_id,
-        'secret_access_key': secret_access_key,
-        'session_token': session_token,
-    }
-    print(res)
 
+lmm()
+exit()
+import boto3
 
-token_dict = {'access_key_id': 'ASIA2E67UIMDVTHGAEEV', 'secret_access_key': 'GncLAqpmcPS+4OjZt+xfg5hZrXDVYDH0jvaulunY',
-              'session_token': 'FwoGZXIvYXdzEBAaDKypPx1gg3gqmDdzfCK+AZ1Z/DS1ZK8jSzrOQnAeB70PnMBK+B7rVPXyiqIilx7gqCAg/xVne9X2bHAItg3b02dGkRrD57CWqHnAeLkpsLMXYxAZsZhgEXW11NmjIAQVc5ZiNyRI8LIvp8s8FrsLLm7zs57TdbPy6i9o1di1silEiwYRQc65iKMOfVH8cOg0iZA0mfDYksuxAmeAo5lQF6JX/7DujtJR/LNzqetv83F400I47vIStBbXtXkqp/qBVMfNIrN9wVA4fmLpvBEop8Gu7gUyKT34Cd4XhwvxdXt4bq8bKm3Bya553WMEsqh0xbG7WJLWP4+8GitU8YWb'}
+boto3_session = boto3.Session(aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_access_key_id)
 
-key = token_dict['access_key_id']
-secret = token_dict['secret_access_key']
-token = token_dict['session_token']
+kv_client = boto3_session.client('kinesisvideo', region_name='us-east-1')
 
-boto3_session = boto3.Session(aws_access_key_id=key, aws_secret_access_key=secret, aws_session_token=token,
-                              region_name='us-east-1')
+STREAM_NAME = "oxoxo"
+print(STREAM_NAME)
 
-kv_client = boto3_session.client('kinesisvideo')
-kv_client.create_stream(DeviceName='string',
-    StreamName='string',
-    MediaType='string',
-    KmsKeyId='string',
-    DataRetentionInHours=123,
-    Tags={
-        'string': 'string'
-    })
+endpoint = kv_client.get_data_endpoint(
+    APIName="GET_HLS_STREAMING_SESSION_URL",
+    # APIName="ListStreams",
+    StreamName=STREAM_NAME
+)['DataEndpoint']
+print(endpoint)
+exit()
 
 res = kv_client.describe_stream(StreamName='test_stream')
 print(res)

+ 0 - 69
Ansjer/test/kbt.py

@@ -1,69 +0,0 @@
-poio = '+08.00'
-print(float(poio))
-tt = float(poio)
-a = 2
-cc = a*tt
-print(cc)
-exit()
-
-aws_access_key_id = 'AKIA2E67UIMD45Y3HL53'
-aws_secret_access_key = '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'
-REGION_NAME = 'us-east-1'  # e.g
-from datetime import datetime
-
-startTime = datetime(2019, 12, 11, 2, 0)
-endTime = datetime(2019, 12, 11, 8, 0)
-print(startTime)
-print(endTime)
-
-
-def lmm():
-    import boto3
-    print('1234')
-    STREAM_NAME = "oxoxo"
-    kvs = boto3.client("kinesisvideo")
-    # Grab the endpoint from GetDataEndpoint
-    endpoint = kvs.get_data_endpoint(
-        APIName="GET_HLS_STREAMING_SESSION_URL",
-        StreamName=STREAM_NAME
-    )['DataEndpoint']
-    print(endpoint)
-    print('----------')
-    # Grab the HLS Stream URL from the endpoint
-    kvam = boto3.client("kinesis-video-archived-media", endpoint_url=endpoint)
-    url = kvam.get_hls_streaming_session_url(
-        StreamName=STREAM_NAME,
-        PlaybackMode="LIVE_REPLAY",
-        HLSFragmentSelector={
-            'FragmentSelectorType': 'PRODUCER_TIMESTAMP',
-            'TimestampRange': {
-                'StartTimestamp': startTime,
-                'EndTimestamp': endTime
-            }
-        },
-    )['HLSStreamingSessionURL']
-    print(url)
-    exit()
-
-
-lmm()
-exit()
-import boto3
-
-boto3_session = boto3.Session(aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_access_key_id)
-
-kv_client = boto3_session.client('kinesisvideo', region_name='us-east-1')
-
-STREAM_NAME = "oxoxo"
-print(STREAM_NAME)
-
-endpoint = kv_client.get_data_endpoint(
-    APIName="GET_HLS_STREAMING_SESSION_URL",
-    # APIName="ListStreams",
-    StreamName=STREAM_NAME
-)['DataEndpoint']
-print(endpoint)
-exit()
-
-res = kv_client.describe_stream(StreamName='test_stream')
-print(res)