-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
46 lines (41 loc) · 1.6 KB
/
app.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
import configparser
import os
from obtentoken import *
from snapshots import *
config = configparser.ConfigParser()
a = config.read("config.ini")
#for i in os.environ:
# print (i,os.environ[i])
if "APPID" in os.environ:
APP_ID = os.environ['APPID']
print ("APP_ID:Ok")
if "SECRET" in os.environ:
SECRET = os.environ['SECRET']
print("SECRET:Ok" )
#APP_ID = config.get("ACCESS", "APP_ID")
#SECRET = config.get("ACCESS", "Secret")
IYO_URL = config.get("ACCESS", "IYO_URL")
URL = config.get("LOCATIONS", "URL")
URL2 = config.get("LOCATIONS", "URL2")
URL3 = config.get("LOCATIONS", "URL3")
Intervalo = 460 #minutos
multiplier = 5 #minutos
time_range = int( Intervalo / multiplier)
sleep_delay = int(60 * multiplier)
#print (sleep_delay)
while True:
token = get_token(APP_ID, SECRET, IYO_URL)
jH = get_headers_js(token)
oH = get_headers_os(token)
for i in range(time_range):
print("Dumiendo, en %s minutos despierto para hacer snaps en %s" % ((time_range - i) * multiplier ,URL))
time.sleep(sleep_delay) # Delay for 1 minute (60 seconds).
print(snapshotcloudspaces(jH,URL))
for i in range(time_range):
print("Dumiendo, en %s minutos despierto para hacer snaps en %s" % ((time_range - i) * multiplier ,URL2))
time.sleep(sleep_delay) # Delay for 1 minute (60 seconds).
print(snapshotcloudspaces(jH,URL2))
for i in range(time_range):
print("Dumiendo, en %s minutos despierto para hacer snaps en %s" % ((time_range - i) * multiplier ,URL3))
time.sleep(sleep_delay) # Delay for 1 minute (60 seconds).
print(snapshotcloudspaces(jH,URL3))