-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.py
65 lines (56 loc) · 1.25 KB
/
init.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import sys
from plistlib import readPlist
import json
query = sys.argv[1]
#print(query)
info = readPlist('info.plist')
instance = info['variables']['instance']
key_code = info['variables']['key_code']
access_key = info['variables']['access_key']
instance_t = ''
key_t = ''
acc_t = ''
if instance == '':
instance_t = "Please input your instance address"
else:
instance_t = "Your instance address is " + str(instance)
if key_code == '':
key_t = "Please input your key code from instance credential page"
else:
key_t = "Your key code is "+str(key_code)
if access_key == '':
acc_t = "Please re run workflow to retrieve access code from instance"
else:
acc_t = "Your access key is saved to workflow variables"
if access_key == '':
res = {"items": [
{
"title":"Instance address",
"subtitle":instance_t,
"arg":query,
"variables":{"type":"instance"}
},
{
"title":"Key code",
"subtitle":key_t,
"arg":query,
"variables":{"type":"code"}
},
{
"title":"Access key",
"subtitle":acc_t,
"arg":query,
"variables":{"type":"access"}
}
]}
else:
res = {'items':[
{
'title':'compose new toot',
'subtitle':'send new toot',
'arg':query,
'variables':{'type':'toot'}
}
]}
res_f = json.dumps(res)
print(res_f)