|
@@ -1,19 +1,5 @@
|
|
|
-#!/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: 2018/12/5 11:52
|
|
|
-@Version: python3.6
|
|
|
-@MODIFY DECORD:ansjer dev
|
|
|
-@file: UidTokenObject.py
|
|
|
-@Contact: chanjunkai@163.com
|
|
|
-"""
|
|
|
-from Ansjer.config import UID_TOKEN_KEY
|
|
|
import jwt
|
|
|
-# UID_TOKEN_KEY = 'c+565*j@%^'
|
|
|
+from Ansjer.config import UID_TOKEN_KEY
|
|
|
|
|
|
|
|
|
class UidTokenObject:
|
|
@@ -43,16 +29,9 @@ class UidTokenObject:
|
|
|
except Exception as e:
|
|
|
print(repr(e))
|
|
|
|
|
|
- def generate(self, data={}):
|
|
|
- token = jwt.encode(data, UID_TOKEN_KEY, algorithm='HS256').decode('utf-8')
|
|
|
- self.token= token
|
|
|
+ def generate(self, data=None):
|
|
|
+ if data is None:
|
|
|
+ data = {}
|
|
|
+ token = jwt.encode(data, UID_TOKEN_KEY, algorithm='HS256')
|
|
|
+ self.token = token
|
|
|
return token
|
|
|
-# uidToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJNVUo4ODdOTFI4SzhHQk05MTExQSJ9.NHYNwmcRLCRBv2FUMA-FlM1Gtx4ir8rrwfoz7QQ67bM'
|
|
|
-# utko = UidTokenObject(uidToken)
|
|
|
-#
|
|
|
-# utko = UidTokenObject()
|
|
|
-# rr = utko.generate(data={'uid':'JW3684H8BSHG9TTM111A','channel':1})
|
|
|
-# print(rr)
|
|
|
-
|
|
|
-# print(utko)
|
|
|
-
|