-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMyData.py
More file actions
45 lines (37 loc) · 1.18 KB
/
MyData.py
File metadata and controls
45 lines (37 loc) · 1.18 KB
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
from ApiCloud import ApiCloud
from CSVDump import *
from datetime import *
import time
import sys
import getpass
#Secret.py is a file with the client id and secret for the API
#Should be of the form:
#client_id = 'user@example.com'
#client_secret = 'longsecretkeyfromparrot'
from Secret import *
print("MyData Version Alpha 0.18")
if sys.version_info[0] <3 :
username=raw_input("Username: ")
else:
username=str(input("Username:"))
password=getpass.getpass()
api = ApiCloud(client_id, client_secret)
if (api.login(username, password) == False):
print ("---------------------")
print ("Logon failed")
print ("---------------------")
sys.exit()
if sys.version_info[0] <3 :
numdays=int(raw_input("Number of Days: "))
else:
numdays=int(str(input("Number of Days:")))
now = time.strftime("%d-%b-%Y %H:%M:%S")
twodays= datetime.now()- timedelta(days=numdays)
stwodays=twodays.strftime("%d-%b-%Y %H:%M:%S")
home = expanduser("~")
SummaryfileCsv = csv.writer(open(home+"/Desktop/"+username + ".csv", "w"))
dumpAllFlowerPower(api, username,stwodays,now)
if sys.version_info[0] <3 :
blank=raw_input("Press Return to finish: ")
else:
blank=str(input("Press Return to finish: "))