|
@@ -31,12 +31,9 @@ class Test(View):
|
|
def get(self, request, *args, **kwargs):
|
|
def get(self, request, *args, **kwargs):
|
|
|
|
|
|
request_dict = request.GET
|
|
request_dict = request.GET
|
|
- # return self.do_apns(request_dict)
|
|
|
|
- # return self.do_get_putOss_url(request.GET)
|
|
|
|
- # from django.http import JsonResponse
|
|
|
|
- # return JsonResponse(status=200,data={
|
|
|
|
- # 'code': 173,
|
|
|
|
- # 'msg': 'data is not exist'})
|
|
|
|
|
|
+ op = request_dict.get('op',None)
|
|
|
|
+ if op:
|
|
|
|
+ return self.do_get_aws_kinesis_vidoe()
|
|
test_push_type = request_dict.get('test_push_type')
|
|
test_push_type = request_dict.get('test_push_type')
|
|
if test_push_type == 'jpush':
|
|
if test_push_type == 'jpush':
|
|
return self.jgPush(request)
|
|
return self.jgPush(request)
|
|
@@ -47,6 +44,39 @@ class Test(View):
|
|
return self.do_gcm_push(request)
|
|
return self.do_gcm_push(request)
|
|
return self.do_alipay_query_status()
|
|
return self.do_alipay_query_status()
|
|
|
|
|
|
|
|
+ def do_get_aws_kinesis_vidoe(self):
|
|
|
|
+ import boto3
|
|
|
|
+ REGION_NAME = 'us-east-1' # e.g
|
|
|
|
+ import json
|
|
|
|
+
|
|
|
|
+ sts = boto3.client(
|
|
|
|
+ 'sts',
|
|
|
|
+ aws_access_key_id='AKIA2E67UIMD45Y3HL53',
|
|
|
|
+ aws_secret_access_key='ckYLg4Lo9ZXJIcJEAKkzf2rWvs8Xth1FCjqiAqUw',
|
|
|
|
+ region_name=REGION_NAME
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ Policy = {"Version": "2012-10-17",
|
|
|
|
+ "Statement": [{"Effect": "Allow", "Action": "kinesisvideo:*", "Resource": [
|
|
|
|
+ "arn:aws:kinesisvideo:us-east-1:697864307463:stream/wpy_stream/1573460250304"]}]}
|
|
|
|
+ credentials = sts.get_federation_token(
|
|
|
|
+ Name='chanjunkai@163.com', # or any unique text related to user
|
|
|
|
+ Policy=json.dumps(Policy),
|
|
|
|
+ DurationSeconds=3600,
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ print(credentials)
|
|
|
|
+ access_key_id = credentials['Credentials']['AccessKeyId']
|
|
|
|
+ session_token = credentials['Credentials']['SessionToken']
|
|
|
|
+ secret_access_key = credentials['Credentials']['SecretAccessKey']
|
|
|
|
+ response = ResponseObject()
|
|
|
|
+ res = {
|
|
|
|
+ 'access_key_id':access_key_id,
|
|
|
|
+ 'secret_access_key':secret_access_key,
|
|
|
|
+ 'session_token':session_token,
|
|
|
|
+ }
|
|
|
|
+ return response.json(0,res)
|
|
|
|
+
|
|
def do_alipay_query_status(self):
|
|
def do_alipay_query_status(self):
|
|
response = ResponseObject()
|
|
response = ResponseObject()
|
|
# app_private_key_string = open(BASE_DIR + '/Ansjer/file/alipay/alipay_private_2048.pem').read()
|
|
# app_private_key_string = open(BASE_DIR + '/Ansjer/file/alipay/alipay_private_2048.pem').read()
|