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