File tree 5 files changed +37
-20
lines changed
5 files changed +37
-20
lines changed File renamed without changes.
Original file line number Diff line number Diff line change
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ from linkv_sdk import linkv_sdk
4
+
5
+
6
+ def main ():
7
+ app_id = 'rbaiHjNHQyVprPCBSHevvVvuNynNeTvp'
8
+ app_secret = '87EA975D424238D0A08F772321169816DD016667D5BB577EBAEB820516698416E4F94C28CB55E9FD8E010260E6C8A177C0B078FC098BCF2E9E7D4A9A71BF1EF8FBE49E05E5FC5A6A35C6550592C1DB96DF83F758EAFBC5B342D5D04C9D92B1A82A76E3756E83A4466DA22635A8A9F88901631B5BBBABC8A94577D66E8B000F4B179DA99BAA5E674E4F793D9E60EEF1C3B757006459ABB5E6315E370461EBC8E6B0A7523CA0032D33B5C0CF83264C9D83517C1C94CAB3F48B8D5062F5569D9793982455277C16F183DAE7B6C271F930A160A6CF07139712A9D3ABF85E05F8721B8BB6CAC1C23980227A1D5F31D23FA6567578AEEB6B124AF8FF76040F9598DDC9DE0DA44EF34BBB01B53E2B4713D2D701A9F913BE56F9F5B9B7D8D2006CA910D8BFA0C34C619AB0EEBDAA474E67115532511686992E88C4E32E86D82736B2FE141E9037381757ED02C7D82CA8FC9245700040D7E1E200029416295D891D388D69AC5197A65121B60D42040393FB42BC2769B1E2F649A7A17083F6AB2B1BE6E993'
9
+ if not linkv_sdk .init (app_id , app_secret ):
10
+ return
11
+
12
+ rtc = linkv_sdk .LvRTC ()
13
+
14
+ print (rtc .GenAuth ())
15
+
16
+
17
+ if __name__ == "__main__" :
18
+ main ()
Original file line number Diff line number Diff line change 3
3
LINKV SDK for the Python programming language.
4
4
"""
5
5
6
- __version__ = '0.4.4 '
6
+ __version__ = '0.4.6 '
7
7
__licence__ = 'Apache-2.0 License'
8
8
__doc__ = 'LINKV SDK for the Python programming language.'
9
9
__all__ = ['linkv_sdk' ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
# -*- coding: UTF-8 -*-
2
2
3
3
from .config import config
4
+ import time
5
+ import hmac
6
+ from datetime import datetime
4
7
5
8
6
9
class Rtc (object ):
7
10
def __init__ (self ):
8
11
pass
9
12
13
+ @staticmethod
14
+ def GenAuth ():
15
+ now = str (int (time .mktime (datetime .now ().timetuple ())))
16
+ data = '{}{}' .format (config ().app_id , now )
17
+ auth_mac = hmac .new (config ().app_key .encode ('utf-8' ), data .encode ('utf-8' ), digestmod = 'SHA1' )
18
+ return {
19
+ 'status' : True ,
20
+ 'app_id' : config ().app_id ,
21
+ 'auth' : auth_mac .hexdigest (),
22
+ 'expire_ts' : now ,
23
+ }
24
+
10
25
11
26
class LvRTC (Rtc ):
12
27
def __init__ (self ):
13
28
Rtc .__init__ (self )
29
+
30
+ def GenAuth (self ):
31
+ return super (LvRTC , self ).GenAuth ()
You can’t perform that action at this time.
0 commit comments