@@ -27,20 +27,68 @@ rm -rf build dist linkv_sdk.egg-info log
2727## Usage
2828
2929``` python
30- from json import dumps
30+ # -*- coding: UTF-8 -*-
3131
3232from linkv_sdk import linkv_sdk
3333
3434
3535def main ():
36- app_id = ' qOPBZYGqnqgCSJCobhLFRtvvJzeLLzDR '
37- app_secret = ' 1EE940FB2E0AB99368DDEF4A7446A17E3418CE9B1721464624A504BBD977A4FC1477F6A1A02B22AF64070A49C32E05B1AC23E47D86BF6C490D637A42735E6DF7589D5644B3DF1BCD489186940ADE4C3D61C6028FCAF90D57FDCA7BA1888DD4B060B2996BCF41087A8CDEE52D775548166FC92B83D88125434597B9394AC3F7C81C9B8A41C0191B0A09AD59F20881A087574C51B0288A1867D8B7EE9CABC97C322F6469E4E19261C7A26527CD65299A564B319F42DB70E016537A5AFAAE896BEE '
36+ app_id = ' rbaiHjNHQyVprPCBSHevvVvuNynNeTvp '
37+ app_secret = ' 87EA975D424238D0A08F772321169816DD016667D5BB577EBAEB820516698416E4F94C28CB55E9FD8E010260E6C8A177C0B078FC098BCF2E9E7D4A9A71BF1EF8FBE49E05E5FC5A6A35C6550592C1DB96DF83F758EAFBC5B342D5D04C9D92B1A82A76E3756E83A4466DA22635A8A9F88901631B5BBBABC8A94577D66E8B000F4B179DA99BAA5E674E4F793D9E60EEF1C3B757006459ABB5E6315E370461EBC8E6B0A7523CA0032D33B5C0CF83264C9D83517C1C94CAB3F48B8D5062F5569D9793982455277C16F183DAE7B6C271F930A160A6CF07139712A9D3ABF85E05F8721B8BB6CAC1C23980227A1D5F31D23FA6567578AEEB6B124AF8FF76040F9598DDC9DE0DA44EF34BBB01B53E2B4713D2D701A9F913BE56F9F5B9B7D8D2006CA910D8BFA0C34C619AB0EEBDAA474E67115532511686992E88C4E32E86D82736B2FE141E9037381757ED02C7D82CA8FC9245700040D7E1E200029416295D891D388D69AC5197A65121B60D42040393FB42BC2769B1E2F649A7A17083F6AB2B1BE6E993 '
3838
39- if not linkv_sdk.init(app_id, app_secret):
39+ if not linkv_sdk.init(app_id, app_secret, 1 ):
4040 return
4141
42- print (dumps(obj = linkv_sdk.im().cfg.__dict__ , ensure_ascii = False ))
43- print (dumps(obj = linkv_sdk.rtc().cfg.__dict__ , ensure_ascii = False ))
42+ live = linkv_sdk.LvLIVE()
43+
44+ third_uid = " test-py-tob"
45+ a_id = " test"
46+ r = live.GetTokenByThirdUID(third_uid, a_id, user_name = ' test-py' ,
47+ portrait_uri = ' http://meet.linkv.sg/app/rank-list/static/img/defaultavatar.cd935fdb.png' )
48+
49+ if not r[' status' ]:
50+ print (' live.GetTokenByThirdUID(%s )' % r[' error' ])
51+ return
52+
53+ print (' token:%s ' % r[' live_token' ])
54+ live_open_id = r[' live_open_id' ]
55+ r1 = live.GetGoldByLiveOpenID(live_open_id)
56+ if not r1[' status' ]:
57+ print (' live.GetGoldByLiveOpenID(%s )' % r1[' error' ])
58+ return
59+ golds0 = r1[' golds' ]
60+ print (' golds0:%d ' % golds0)
61+ unique_id = ' 1231234'
62+ gold = 10
63+ r2 = live.SuccessOrderByLiveOpenID(live_open_id, unique_id, linkv_sdk.OrderTypeAdd, gold, 10 , 1 ,
64+ linkv_sdk.PlatformTypeH5, ' ' )
65+ if not r2[' status' ]:
66+ print (' live.SuccessOrderByLiveOpenID(%s )' % r2[' error' ])
67+ return
68+
69+ golds1 = r2[' golds' ]
70+ print (' golds1:%d ' % golds1)
71+ if (gold + golds0) != golds1:
72+ print (' (golds0+gold) != golds1' )
73+ return
74+
75+ unique_id1 = ' 456456'
76+ ok = live.ChangeGoldByLiveOpenID(live_open_id, unique_id1, linkv_sdk.OrderTypeDel, gold, 1 , ' test del' )
77+ if not ok:
78+ print (' !ok' )
79+ return
80+
81+ r3 = live.GetGoldByLiveOpenID(live_open_id)
82+ if not r3[' status' ]:
83+ print (' live.GetGoldByLiveOpenID(%s )' % r3[' error' ])
84+ return
85+ golds2 = r3[' golds' ]
86+ print (' golds2:%d ' % golds2)
87+
88+ if golds0 != golds2:
89+ print (' golds0 != golds2' )
90+
91+ print (' success' )
4492
4593
4694if __name__ == " __main__" :
0 commit comments