-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·81 lines (75 loc) · 1.79 KB
/
main.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env
# Import libs
from decipher.beacon import api
from deciphertools import tools
import csv, sys, re, datetime, dateutil.parser, os, getpass
debug=0
# Set utilities
# reload(sys)
# sys.setdefaultencoding('utf-8')
dec = tools()
dec.validate_modules()
# Tool select
def tool_action():
exit = 0
tool_action = -9
while tool_action not in range(0,5):
print("""> Choose an action:
(1) retrieve datamaps
(2) review Decipher usage
(3) get quota info
(4) search or export surveys
(0) exit""")
tool_action = input()
if debug == 1:
print("[DEBUG] tool_action: {}".format(tool_action))
try:
try:
tool_action = int(tool_action)
except:
if debug == 1:
print("[ERROR] Invalid input")
break
if tool_action == 0:
if debug == 1:
print("[DEBUG] tool_action: {}".format(tool_action))
exit = 1
if debug == 1:
print("[DEBUG] exit value: {}".format(exit))
return exit
if tool_action == 1:
"""Data map"""
if debug == 1:
print("[DEBUG] tool_action: {}".format(tool_action))
import datamap
return exit
elif tool_action == 2:
"""Decipher Usage"""
if debug == 1:
print("[DEBUG] tool_action: {}".format(tool_action))
import usage
return exit
elif tool_action == 3:
"""Quota"""
if debug == 1:
print("[DEBUG] tool_action: {}".format(tool_action))
import quotas
return exit
elif tool_action == 4:
"""Search / export survey overview"""
if debug == 1:
print("[DEBUG] tool_action: {}".format(tool_action))
import surveys
return exit
else:
print("[ERROR] Invalid input")
pass
except:
print("[ERROR] {}".format(sys.exc_info()[0]))
raise
exit = 0
while exit != 1:
if debug == 1:
print("[DEBUG] exit value: {}".format(exit))
exit = tool_action()
print("Bye")