-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_outlook_apptmt.py
More file actions
61 lines (48 loc) · 1.56 KB
/
make_outlook_apptmt.py
File metadata and controls
61 lines (48 loc) · 1.56 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from datetime import datetime
from datetime import timedelta
import win32com.client
from absl import app
from absl import flags
FLAGS = flags.FLAGS
flags.DEFINE_string("job",
None,
"job name, currently supports "
+ "GECM_RefreshAmazonFreshPN"
#+ ", " + CUSTOMER_KROGER_PICKUP
)
flags.DEFINE_float("delay",
30,
"Delay minutes")
flags.DEFINE_bool("debug",
False,
"Run in debug mode")
# Required flag
flags.mark_flag_as_required("job")
def main(argv):
del argv
job = FLAGS.job
delay = FLAGS.delay
debug = FLAGS.debug
#minutes = 30
now = datetime.now() + timedelta(minutes=delay)
# dt_string = now.strftime("%Y-%m-%d %H:%M:%S")
dt_string = now.strftime("%Y-%m-%d")
tm_string = now.strftime("%H:%M:%S")
start = dt_string + ' ' + tm_string
subject = "[Man File Load] Check SS Agent job '" + job + "'"
#print(start, subject)
#exit(1)
addevent(start, subject)
def addevent(start, subject):
# datetime object containing current date and time
oOutlook = win32com.client.Dispatch("Outlook.Application")
appointment = oOutlook.CreateItem(1) # 1=outlook appointment item
appointment.Start = start
appointment.Subject = subject
appointment.Duration = 5
appointment.Location = 'NA'
appointment.ReminderSet = True
appointment.ReminderMinutesBeforeStart = 1
appointment.Save()
if __name__ == "__main__":
app.run(main)