File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ import requests
2
+ import time
3
+ import hashlib
4
+ import console
5
+ import dialogs
6
+
7
+
8
+ def main ():
9
+ # 多行文本
10
+ text = dialogs .text_dialog ("这次想bb点啥?" )
11
+ # 单行文本
12
+ #text = console.input_alert(u'这次想bb点啥?')
13
+ if not text :
14
+ print ('No text input found.' )
15
+ return
16
+ appId = 'Xq4li4CYL95Qv9GsJSiB8B2M-MdYXbMMI'
17
+ masterKey = 'Kaa95X0LUHflxIojiFn7spsU'
18
+ timestamp = int (round (time .time () * 1000 ))
19
+
20
+ ret = str (timestamp ) + masterKey
21
+ sign = hashlib .md5 (ret .encode ('utf-8' )).hexdigest ()
22
+ data = {"content" : text }
23
+
24
+ headers = {
25
+ 'Content-Type' : 'application/json' ,
26
+ 'X-LC-Id' : appId ,
27
+ 'X-LC-Sign' : "{},{},master" .format (sign , timestamp )
28
+
29
+ }
30
+
31
+ url = 'https://{}.api.lncldglobal.com/1.1/classes/content' .format (
32
+ appId [:8 ])
33
+
34
+ print (u'开始bb...' )
35
+
36
+ r = requests .post (url , json = data , headers = headers )
37
+
38
+ print (u'bb中...' )
39
+
40
+ if r .status_code == 201 :
41
+ print (u'bb成功!' )
42
+ print (r .text )
43
+ else :
44
+ print (u'bb失败!' )
45
+ print (r .text )
46
+
47
+
48
+ if __name__ == '__main__' :
49
+ main ()
You can’t perform that action at this time.
0 commit comments